Difference between Running and Starting a Docker container

653    Asked by FionaDickens in Devops , Asked on Jul 6, 2021

While practicing docker, I use this command for starting up a container:

$ docker run a8asd8f9asdf0

This brings a question to my mind, "what the use of docker start?"

$ docker start
Answered by Gayatri Jaiteley

Here we have docker run vs start but to get a clear idea let's define both:

Start: This is used to startup a container that was previously stopped for whatever purpose.

for E.g. If you used docker stop CONTAINER_ID to stop a container,all you need to do is to use docker start CONTAINER_ID command to restart the previously stopped container and no data would be lost.

Run: This is used to create completely new containers using an image and then starting them up. You can create multiple replicas of the same image,

This is the command : docker run IMAGE_ID

Hope that helped:)

Note: Start will start any stopped containers. This includes freshly created containers. Run is a combination of creating and start. It creates the container and starts it.



Your Answer

Interviews

Parent Categories