The new hotness in the Linux container space (because nobody remembers LXC
anymore).
Resources
Category | Date | Link | Notes |
---|---|---|---|
Base Images | 2015 | gliderlabs/alpine | A minimal Alpine Linux base image |
phusion/baseimage-docker | an arguably sane Ubuntu base image |
||
CLI | codekitchen/dinghy | a nice wrapper that sets up a host NFS server and other niceties |
|
Wharfee | a nice CLI wrapper |
||
2014 | dockersh | Segregate logged in users into different containers |
|
Distros | 2013 | Core OS | a lightweight distro focused on containers, since acquired by RedHat |
GUI | 2016 | Portainer | a simple NodeJS Web UI |
2015 | Portus | A registry front-end that works with the v2 registry and has some user management features. |
|
2014 | Seagull | A Web UI for container management |
|
Mac Alternatives | 2021 | podman-macos | a menubar item to manage podman machine, which is in turn available on Homebrew |
lima | a possible replacement for Docker Desktop on Mac |
||
2019 | boot2docker-xhyve | a clean way to run Docker inside Hypervisor.framework |
|
Network | 2018 | pipework | map physical interfaces to specific containers |
2015 | socketplane | Auto-discovery and OVS for inter-host traffic |
|
2014 | weave | inter-host tunneling, with encryption |
|
OCI Tools | 2019 | docker-slim | performs simple runtime analysis to remove unnecessary libraries and slim down images |
2018 | buildah | a CLI tool for builting OCI container images from |
|
Orchestration | 2015 | Kubernetes | The current industry favorite |
Rancher | Still arguably one of the nicer options in 2018 |
||
Other runtimes | 2022 | nerdctl | can be used to manage containers in containerd/k3s |
2019 | podman | aims for 1:1 CLI parity (see also Buildah and Skopeo) |
|
2018 | Singularity | a different take on containers, not quite OCI compliant |
|
PaaS | 2020 | CapRover | a nice web front-end for Docker Swarm |
Tools | 2024 | lazydocker | a nice TUI for Docker management, with usage charts and easy stack/compose viewing (Portainer for terminals) |
2023 | distrobox | a nice wrapper for sandbox management |
|
colima | a macOS VM container manager that replaces Docker desktop and works well with |
Setting up boot2docker
manually on Parallels
Since I don’t have Parallels Pro, I run Docker on my older Macs like this:
- Download a recent release and put the ISO someplace safe
- Create a new VM manually by dragging the ISO to Parallels (use the
Shared
orNAT
network type) - After first boot, use
fdisk
to create a primary partition in/dev/sda
and format it usingmkfs.ext4 -L boot2docker-data /dev/sda1
- Reboot so that it gets mounted and used for certificate storage
- Do
brew install docker
(which gets you the CLI) - Set up port forwarding for port 2376 and a local port to the VM’s SSH port
- SSH into the VM (
docker
/tcuser
) and copy the*.pem
files from/var/lib/boot2docker/tls
to your~/.docker
folder - Set and export
DOCKER_HOST
andDOCKER_TLS_VERIFY
accordingly:
export DOCKER_HOST=localhost:2376
export DOCKER_TLS_VERIFY=1
Useful Dockerfile
Snippets
Base Image | Description | Dockerfile snippet |
---|---|---|
Ubuntu | Installing the Oracle JDK (and setting the EULA) | RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | debconf-set-selections \ && add-apt-repository -y ppa:webupd8team/java \ && apt-get install -y java-common oracle-java8-installer oracle-java8-set-default \ && rm -rf /var/cache/oracle-jdk8-installer |
Building The Docker Registry From Scratch (on ARM, too!)
Very simple, really, once you have Go installed. Quite quick on a Raspberry Pi 2, too:
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$PATH
# this fetches godep and golint
go get github.com/tools/godep github.com/golang/lint/golint
# this fetches and builds the registry
go get github.com/docker/distribution/cmd/registry
# test it with the default config
$GOPATH/bin/registry $GOPATH/src/github.com/docker/distribution/cmd/registry/config.yml
Restarting a Container Automatically in Docker Compose
Since watchtower
only does updates and not restarts (which seems like a missed opportunity), this simple snippet will restart a container at a specific time every day:
version: "3"
services:
myservice:
container_name: myservice
restarter:
image: docker:cli
restart: unless-stopped
volumes: ["/var/run/docker.sock:/var/run/docker.sock"]
entrypoint: ["/bin/sh","-c"]
command:
- |
while true; do
current_epoch=$$(date +%s)
target_epoch=$$(( $$(date -d "05:00" +%s) + 86400 ))
sleep_seconds=$$(( target_epoch - current_epoch ))
echo "$$(date) + $$sleep_seconds seconds"
sleep $$sleep_seconds
docker restart myservice
done