Examine the evolution of virtualization technologies from bare metal, virtual machines, and containers and the tradeoffs between them.
Explores the three core Linux features that enable containers to function (cgroups, namespaces, and union filesystems), as well as the architecture of the Docker components.
Install and configure Docker Desktop
Use publicly available container images in your developer workflows and learn how about container data persistence.
Building out a realistic microservice application to containerize.
Write and optimize Dockerfiles and build container images for the components of the example web app.
Use container registries such as Dockerhub to share and distribute container images.
Use Docker and Docker Compose to run the containerized application from Module 5.
Learn best practices for container image and container runtime security.
Explore how to use Docker to interact with containers, container images, volumes, and networks.
Add tooling and configuration to enable improved developer experience when working with containers.
•Developer Experience Wishlist
Deploy containerized applications to production using a variety of approaches.
The general approach we will use to deploy our application is:
Create a virtual machine on your preferred cloud provider. I use Civo in the video, but you are welcome to choose another (e.g., AWS, GCP, or Azure).
Configure the firewall for your virtual machine to allow inbound traffic on the necessary ports.
Install Docker Engine on your virtual machine using the script located at get.docker.com.
ssh ubuntu@YOUR_IP_ADDRESS
curl https://get.docker.com/ | sh
sudo groupadd docker
sudo usermod -aG docker $USER
Connect your local Docker client to the Docker Engine running on the virtual machine using the DOCKER_HOST
environment variable. Initialize Docker Swarm on the remote machine.
export DOCKER_HOST:="ssh://ubuntu@YOUR_IP_ADDRESS"
docker swarm init
Add health checks to your Docker Compose file to allow Swarm to periodically ping your service and restart it if necessary.
Add a deployment strategy to enable zero-downtime deployments.
Implement Docker secrets in your Docker Compose file to securely handle credentials for your database.
We can use the following command to create the secrets in the swarm cluster:
export DOCKER_HOST:="ssh://ubuntu@YOUR_IP_ADDRESS"
printf "foobarbaz" | DOCKER_HOST=${DOCKER_HOST} docker secret create postgres-passwd -
printf "postgres://postgres:foobarbaz@db:5432/postgres" | DOCKER_HOST=${DOCKER_HOST} docker secret create database-url -
Build your container images and push them to Docker Hub with specific image tags.
Deploy your stack onto the virtual machine and see it running.
export DOCKER_HOST:="ssh://ubuntu@YOUR_IP_ADDRESS"
docker stack deploy -c docker-swarm.yml example-app
This guide demonstrates deploying the database alongside the applications. While this is acceptable, you should also consider implementing backups and/or using a Database-as-a-Service for production applications with important user data.