Elton's Container Show - resources for the YouTube broadcast
Orchestration means using a container platform to manage your apps. Instead of running containers yourself, you send a model of your app to the orchestrator and it runs the containers.
The most popular orchestrator is Kubernetes, which is hugely powerful but complex - in the next few episodes we’ll compare Kubernetes, Docker Swarm and Nomad.
This episode looks at the basic feature set in orchestration and looks at how Docker Compose measures up compared to full container platforms.
Here it is on YouTube - ECS-O1: Understanding Container Orchestration
We start this week with some slides to set the scene.
You’ll find them here in ecs-o1.pptx.
You can use Docker Desktop to follow the Compose demos.
I’m using a separate Linux VM running Docker, using Vagrant.
You can set that VM up with:
cd episodes/ecs-o1/vagrant
vagrant up linux
vagrant ssh linux
This Docker Compose file has all the orchestrator-y features, with abstractions for compute and networking and config injection.
But Docker Compose is just a client-side tool which does a manual reconcilation with the Docker Engine when you run up
commands. It doesn’t manage containers for you.
Run the boring to-do demo app:
cd /ecs-o1
docker-compose up -d
ip address
Browse to the app on the host port
8030
and add an item
Now kill the app process:
docker exec ecs-o1_todo-web_1 sh -c 'kill 1'
docker ps
Compose doesn’t restart the container
Restart the Docker Engine:
sudo service docker restart
docker ps
Delete the database container and start the app again:
docker rm -f ecs-o1_todo-db_1
docker-compose up -d
The app works but the original data is lost
You’ll never get true HA running containers with Docker Compose because it only manages a single server - lose the server and you lose all your apps.
But if one server is all you have (for low-volume apps or test environments) you can increase availability with restart
and volume
configurations.
These are set in the updated to-do spec in docker-compose-ha.yml.
Clear containers and start a new copy of the app:
docker rm -f $(docker ps -aq)
docker-compose -f docker-compose-ha.yml up -d
docker ps
docker volume ls
Refresh the app and add a new item
Now kill the app process:
docker exec ecs-o1_todo-web_1 sh -c 'kill 1'
docker ps
The container is restarted
Restart the Docker Engine:
sudo service docker restart
docker ps
Delete the database container and start the app again:
docker rm -f ecs-o1_todo-db_1
docker-compose -f docker-compose-ha.yml up -d
The app works and shows the data - but you need to make sure you use the right Compose file
The ACI version uses the same Docker Compose spec, but using Azure Files for configuration storage, and a managed Postgres database in Azure: docker-compose-aci.yml.
docker context ls
docker context use ecs-o1
Deploy:
cd episodes/ecs-o1
docker compose -f docker-compose-aci.yml up -d
docker ps
Test the app…
docker compose down
vagrant destroy linux