Blog / Docker Quick Start: Common Commands
Oct 19, 2023 · 2 mins read
249 views
$ docker
This will simply launch the Docker CLI and show the available options and commands.
$ docker run hello-world
This will run the “hello-world” image and display a message indicating that Docker has been successfully installed and is working properly.
$ docker inspect hello-world
This will inspect the “hello-world” image and display detailed information about it, such as its size, the environment variables it uses, and the command it runs.
$ docker images
This will show a list of all the images that are currently stored on the local system.
$ docker pull <Image_name>
This will download an image from the Docker hub to the local system, where Image_name is the name of the image to be pulled. For example: docker pull node
$ docker ps -a
This will show a list of all containers that have been created, both running and stopped. The -a option is used to display all containers, not just the running ones.
$ docker run --name nodeContainer -d node
This will run a container with the name “nodeContainer” in detached mode (the -d option) using the “node” image.
$ docker run --name nodeContainer -it -d node
This will run a container with the name “nodeContainer” in detached mode (the -d option) and in interactive mode (the -it option) using the “node” image.
$ docker stop nodeContainer
This will stop the “nodeContainer” container that was created in an earlier command.