Welcome to my Docker Essentials series, which teaches you the basics you’ll need to know in order to get started with Docker. In this video, we look at the process of running containers on our host.
Commands used in this video
Search for available container images
docker search
Run the Ubuntu container
docker run ubuntu
Note: The container will just exit, since it needs some sort of task to run in order to stay running (as explained in the video).
Show running containers
docker ps
Show all containers
docker ps -a
Show locally downloaded images
docker images
Run the Ubuntu container, and attach to a command prompt
docker run -it ubuntu /bin/bash
Note: Since we gave it a task to perform (/bin/bash) it will stay running.
Install vim inside the container
After attaching to a bash shell within the container, run:
apt update apt dist-upgrade
Docker containers are not stateful
The video shows the process of installing vim inside the container, and after exiting and relaunching the container, vim is no longer present and has to be installed again. Saving changes to containers will be discussed later on in the series.