What is the difference between Running and Starting a Docker container?

Better Stack Team
Updated on April 14, 2023

In Docker, the difference between running and starting a container is as follows:

  • Running a container means that the container is already started and is currently executing its main process. This can be confirmed by using the command docker ps, which lists all running containers.
  • Starting a container means that the container is not running and needs to be started in order to execute its main process. This can be done using the command docker start <container_id>.

When you create a new container using the docker run command, it is automatically started and enters a running state. However, if you stop the container using the docker stop command, it enters a stopped state and needs to be started again using the docker start command.

It is also possible to start a container in a detached mode (i.e., in the background) using the -d option with the docker run command. This will start the container but will not attach the terminal to it. In this case, you can use the docker attach command to attach to the running container and interact with it.

Make your mark

Join the writer's program

Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.

Write for us
Writer of the month
Marin Bezhanov
Marin is a software engineer and architect with a broad range of experience working...
Build on top of Better Stack

Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.

community@betterstack.com

or submit a pull request and help us build better products for everyone.

See the full list of amazing projects on github