Docker Notes
Reference
Get Started
I spent a couple days going over the basics of Docker.. just wanted to summarize what I’ve learned. I should probably just invest my time in EverNote instead of typing up these markdown pages. But honestly, challenge accepted.
Terms
Image - A read-only package that is housed within a container
Container - This is a runtime of images defined by a Dockerfile. I don’t know what all goes in this yet but it seems to define what directories exist and what ports to open up from the container to the host. More TBD.
Service - Scaling and load balancing. This is where you define what service a container will function as (ie. web) and define parameters like how many container replicas.
Replica - Basically a container instance on a single host machine running docker engine.
Swarm - When you begin clustering multiple docker hosts (with their own docker engines running) then these are called swarms. Apps can quickly be deployed to swarms configured to talk to each other.
Node - A single docker host in a swarm.
Stack - The docker compose basically defines this. It can consist of different services that deploy containers (ie. web, db, etc.)
Note to self - learn YAML.
Commands
General
docker container ls
- list containers on a host
docker service ls
- list services on a host
docker service ps <service>
- show tasks spawned by a service (services run tasks, tasks then spawn containers)
Swarm Manager
docker node ls
- list nodes in a swarm (swarm manager command)
docker stack deploy -c <yaml file> <name>
- Deploy an app to a swarm
docker stack rm <name>
- Undeploy an app from a swarm
docker swarm init
- initialize a swarm manager
docker swarm join --token <blah> ...
- look for this command when performing a swarm init to join nodes to the swarm
docker swarm leave (--force)
- have a node leave a swarm
Other observations
Docker machine
- Used for managing docker engine node machines
- Controls local virtual machines and can utilize virtualbox/hyperv/etc.
- Seems like local virtual machines with multiple docker container could potentially be a good localized development environment?
Docker compose files
- docker-compose is needed (I believe) for compose YAML files to work
- replicas define the number of containers for a given service on a swarm. This means “5” could be 2 on one node, 3 on another in a 2 node swarm.
- overlay networks seem to be distributed networks, or like distributed switches in vmware. More TBD here.
- ports define how to map container ports for a service to the actual host ports that can be connected to
- volumes are used to define common “source of truth” directories for persisting data. More TBD here.
- placement constraints can limit where a particular service is deployed (ie. only node1, not node2, this or that.. blah blah)
Music
Per usual, spinning music is constant for me.
I’ve always been a pretty big fan of Neurosis. This is Steve Von Till’s personal project, and I highly recommend zoning out to it (especially White Horse).
White Horse
The stones call to me, just as they always have.
A gateway to the mysteries, and a pathway to the ancestors.
Place my hands in the ashes, dream inside the earth.
Feel the pulse, the magnetic pull between me and the stone.
Witness the daystar rising, as Earth's fire rises,
up through the spine, filling the heart,
exploding the mind, and erupting from the crown of my skull.