Lab 2 Docker - Avery-Luther/SYS-265 GitHub Wiki

In this lab I will be configuring a new VM! docker01 will be used to run docker containers. It runs Ubuntu server, and that entailed a new set of steps for initial configuration.

  • Using adduser to add a new user (I tried to use useradd at first. it did not end well.)
  • Changing the password using passwd
  • Adding it to the sudo group using usrmod -G
  • Changing the host name by modifying cloud.cfg, the hostname file, and the hosts file.
  • And changing the IP settings by modifying the netplan config files.

Once that was completed, I had to install docker. Unfortunately this isn't as straight forward as a sudo apt install docker. First I needed to install a few tools to install docker.

  • apt-transport-https
  • ca-certificates
  • curl
  • software-properties-common Then I added docker's GPG key to my system with curl and apt-key. After that I added the docker repository to apt. Finally I could run sudo apt install docker-ce. We did that whole dance to get the latest version for Ubuntu specifically.

Installing Docker Compose

This is a little bit easier than installing docker. Simply curl -L -o the latest version of docker compose from github into the /usr/local/bin directory. Give the executable execute perms and you're all set.

Using Docker

A few fun commands for docker:

  • docker run: Runs an image and if it doesn't exist locally, it will pull it from the web!
  • docker ps: Shows all of the docker images running in the background.
  • docker-compose up: Takes a compose.yaml file, and runs the config within to install images and set its environment variables.
  • docker-compose down: Stops any given config inside of a compose.yaml