Start your first Docker Container¶
In this lecture you are going to start your first container, step by step. I'll explain all the flags and everything that happens in depth.
Video¶
Commands¶
docker run -it ubuntu /bin/bash
- Flags:
-it
: interactive flag
ls
Now open a second terminal/console:
docker ps
Start this from a second terminal which lists the currently running container
exit
Exits the container and the linux file system again
docker ps
Lists the currently running containers, which is empty
docker ps -a
Lists all containers, the running ones and the empty ones
docker start container_identifier
We can restart a container that was previously running
docker ps
The container comes up as running again. Creation date != running date
docker attach container_identifier
We can re-attach to the container
docker stop container_identifier
stop the running container
docker ps
docker ps -a
docker rm container_identifier
docker ps -a
And the list is empty again