Basic Docker commands

less than 1 minute read

Basic Docker commands:

This article we will see some basic Docker commands.

docker run

docker run command starts a container. For example - docker run nginx command will run an instance of a nginx application from the docker host, if the image already exists. If nginx image does not exists on docker host then it will try to download it from docker hub, and then run the image. Image is pulled down only first time. If you want to start another instance of nginx application on same docker host then docker will use the same image.

docker ps

docker ps command list all running containers with some basic information about them, such as Container ID, Image Name, Current status, Container Name etc. Each container automcatically gets a random Id.

To see all containers, whether they are running or not use -a flag with docker ps command. docker ps -a

docker stop

docker stop command is use to