We will help you to understand how to start docker container. For this, we use “docker start” command with various options.
“docker start” command starts one or more stopped containers..
Command:
docker start container_name_1 container_name_2 …
How docker start command works ?
- docker start command triggers docker engine to start docker container.
- It starts the stopped container.
- If the given container name is not present then docker engine throws the error as “
No such container: container_name
“
Example:
% docker start ubuntu
% docker ps
CONTAINER ID | IMAGE | COMMAND | CREATED | STATUS | PORTS | NAMES |
9b815c2b0d3c |
ubuntu:latest |
“bash” |
22 hours ago |
Up 22 hours |
ubuntu |
You can also start container with various options.
Name, shorthand | Description |
--attach , -a |
Attach STDOUT/STDERR and forward signals |
–detach-keys | Override the key sequence for detaching a container |
--interactive , -i |
Attach container’s STDIN |
Example:
% docker start -a ubuntu It will start ubuntu container and will expect input from STDIN.
To learn more about docker, Pls click given below link.
https://techieindoor.com/category/docker/
References:
https://en.wikipedia.org/wiki/Docker_(software)