The purpose of this assignment is to get familiar with the basics of docker such as pulling an image, creating and running a container and docker hub.
What is Docker?
Basic Docker Commands
Introduction to Docker (LAB)
1 Docker Exercise
b. Display list of all images on your system. Make sure that you have busy box as well. Write the image id for the buysbox image.
Image ID 42b97d3c2ae9 c. Run a docker container based on the busybox image i. Docker run busybox
-
Nothing happens. This is not true, a lot has happened in the background but because you did not provide a command, it ran an empty command and then exited.
ii. Check what containers are currently running.
iii. List all containers that exited.
d. Get into the interactive terminal with the -it flag and run ubuntu. It attaches an interactive terminal in the container. You can now run multiple commands. Run some of the following commands
-
Get into the home folder and create a home directory for yourself. The directory name can be your own name.
-
We want to use nano text editor in the ubuntu image but is not available. Lets first update by typing apt-get update and then install nano apt-get install nano
-
Get into the home folder and create a simple text file. Write a couple of lines in the text file such as your name.
e. Now that we have several images. Let’s delete the busybox image.
f. Delete all containers that have a status of exited.
- Cleaning Up a. We have containers and images that won’t be used anymore. They occupy space therefore let’s find them and delete them
c. Delete all images and containers that you won’t need anymore.
d. Submit the output for docker ps -a and docker images
- Create an account in Docker Hub and browse for interesting images. List some that could be useful for you.
Some useful images:
Ubuntu
Mysql
Maiadb
Wordpress
Django
Apach
Tomcat
Joomla
Ruby on Rails