You can use the Docker start command to startup containers that are stopped. You can use it to start one or more than one stopped container simultaneously. The Docker container start command will start the container and run it in the background. This will start all the processes running inside the container. This is different from the Docker run command which is used to create a new container. When we execute the run command on an image, it will pull the image, create a new container, and start it automatically. However, you can only invoke the Docker start command on containers that have already been created before.
You can check out our complete and free Docker Tutorials.
Docker Container Start Command
To startup a Docker container, you simply need to execute the Docker container start command by passing the container ID or name along with this command. The syntax to startup a Docker container is –
$ docker container start [OPTIONS] CONTAINER [CONTAINER...]
You can also emit the container keyword from the above command and it will still work.
$ docker start [OPTIONS] CONTAINER [CONTAINER...]
There are several options that you can use along with the Docker start command to startup a container. Let’s check them out.
|-a||It is used to attach a STDOUT or STDERR stream and forward the signals.|
|This option can be used to restore from the mentioned checkpoint.|
|You can specify a customized storage directory as a checkpoint.|
|This option can be used to override the sequence of the key that is used for detaching a Docker container.|
|-i||You can use the interactive option to attach the terminal to a container’s STDIN.|
How to Start a Docker Container?
Let’s see how we can use the Docker start command. We will first use the Docker container list command to list all the existing and active containers in our machine.
We can use the following command to list all the existing containers.
$ docker container ls -a
You can see that we have a container called myubuntu which is currently in the exited state. This means that the container was created before but is not running actively now. Let’s verify the same by listing all the active containers.
$ docker ps
Now, let’s invoke the Docker start command on the container to start it.
$ docker start myubuntu
You can see that the command has returned the name of the container. This means that the container has been started automatically.
Let’s list all the active containers to verify the same.
You can see that the container is now up and running.
If you want to get access to the container’s bash, you can use the
As discussed, we can use the Docker start command to startup a stopped Docker container. You can only use this command on those containers that were previously created using the Docker run command. You can also use several options such as interactive, attach, checkpoint, etc. along with it.
If you have any queries or suggestions, please mention them in the comment box. Our experts will get back to you as soon as possible. Also, check out our complete and free Docker Tutorials.
Recommened Articles –
We recommend you the following articles to understand the topic in a better way.