Lab – Container
In this lab exercise, we are practicing container service setup using docker.
We'll be using the virtual machine as instructed in last week's practical exercise. The instructions in
this exercise requires a Ubuntu user account with the superuser privilege.
For virtualbox, the following image can be used:
https://cloudstor.aarnet.edu.au/plus/s/Z5Ia900kcdt1BYK
For VMWare Fusion, the following image can be used:
https://cloudstor.aarnet.edu.au/plus/s/1epWCSHq74g0IQr
The user password for both image: virtualbox
Install docker client
Open a terminal, and type the following command
sudo apt-get update
sudo apt-get install docker.io
(type in the superuser password if prompted)
Hello word
Type the following command on the terminal
sudo docker search hello-world
You shou see a list of available docker images.
Exercise: discuss how do you find out docker command options.
Exercise: use the docker search command to find out images with 100 or more stars.
Let's pick the image hello-world which is officially supported, and download/pull the image by
sudo docker pull hello-world
Then, let's run the docker by
sudo docker run hello-world
Then, you should see a welcome message starting with "Hello from Docker!".
To show all the containers, type the following command
sudo docker ps -a
To examine the downloaded images, type the following command
sudo docker images
Note: to remove images (docker rmi), you need to firstly remove (docker rm) all containers (found
by docker ps -a)
Exercise: compare a virtualbox guest OS image and a docker image, and discuss the difference of
the image size.
Busybox
Busybox is an open-source project, which includes a set of tiny versions (with reduced features) of
UNIX utilities in one executable file. Commands that busybox supports can be found at
https://busybox.net/downloads/BusyBox.html, as well as instructed below. Busybox is frequently
used on embedded devices running Unix.
sudo docker run -t -i busybox
Type the following command to show the list of supported commands:
busybox --help
Exercise: Type the following commands under busybox, and explain your findings on the inode
number and access/modify/change dates:
stat /bin/ls
stat /bin/pwd
You can terminate the interactive session with
exit
Exercise: search and run a web-server
Use docker commands illustrated above, install and run a web-server. Use a browser (such as
Firefox) to open http://localhost to examine whether the web-server is operating properly or not.