Docker - tmansfield42/Tech-Journal GitHub Wiki

Docker Lab Setup Guide

The Docker lab focused on containerization using Docker on an Ubuntu 20.04 cloud server. The lab involved configuring network settings, installing Docker, running Docker containers, and deploying a WordPress instance using Docker Compose.

1. Configure system

00-installer-config.yaml

2. Install Docker

sudo apt update

sudo apt install apt-transport-https ca-certificates curl software-properties-common

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable"

sudo apt install docker-ce

sudo usermod -aG docker michael

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

sudo chmod +x /usr/local/bin/docker-compose

3. Configure Docker

mkdir ~/wrdpress

cd ~/wrdpress

nano index.html

index.html

nano docker-compose.yml

docker-compose.yml

docker-compose up -d

docker-compose ps

4. Common Docker Commands

docker-compose up -d: Starts Docker containers defined in the docker-compose.yaml file in detached mode.

docker run: Runs a Docker container.

docker-compose ps: Lists containers managed by Docker Compose.

docker ps: Lists running containers.

docker stop [container_name]: Stops a running container.

docker run -d -P training/webapp python app.py: Runs a container in detached mode and publishes exposed ports.

5. Adding a user to superuser group

In Ubuntu this works a little differently than Centos 7. The superuser group which I've been used to is wheel but for Ubuntu it's sudo which honestly makes more sense. Doing this allows a named user to use the sudo feature in linux.

6. Conclusion

This lab was really hard for me to complete. It has easily been the longest lab simply because I made so many mistakes. This documentation cuts all the fat and leaves just the juicy parts. If I were to redo this lab I could follow this tech journal and get it done in 15 minutes.