many old articles, check to publish dates
Docker packs your apps and services in a portable container.
Docker Way
The Docker Engines provides the Docker Remote API and interface with container execution backend, Docker's own tools and tools from 3rd can interacts with this API to provide higher level features on Docker containers.
dotScale 2013 - Solomon Hykes - Why we built Docker - YouTube
On the contrary, boycott docker.
Martin Heinz - It's Time to Forget About Docker
Docker - Build, Ship, and Run Any App, Anywhere
Docker overview | Docker Documentation
Docker Docs Docker Glossary
The Docker user guide
veggiemonk/awesome-docker: A curated list of Docker resources and projects
Docker Engine | Docker
Engineering | Docker Blog
Resources | Docker
Docker Training - Docker Training
Docker for Beginners | TestDriven.io
Introducing Two New Community Repositories: Docker Labs and Docker Community | Docker Blog
docker/community
Docker Crash Course for Absolute Beginners [NEW] - YouTube 2023-02, 1:07:38
Docker Tutorial for Beginners [FULL COURSE in 3 Hours] - YouTube 2020-10, 2:46:15
Introduction to Docker - YouTube
Docker at Spotify - YouTube
Docker 101 session - YouTube
Docker 101: Dockerizing Your Infrastructure - YouTube
Docker fundamentals: basics, storage, networking - Introduction to Docker - YouTube
Docker - YouTube Level Up
Gist of Docker:
- Install Docker Engine
- (optional) Use Dockerfile to create a Docker Image
- Run the Images (built locally or pulled from Docker Registry/Docker Hub) in a Docker Container, see Get Started, Part 2: Containers | Docker Documentation
- Profit
docker error creating new backup file '/var/lib/dpkg/status-old': Invalid cross-device link
Docker overlay2 metacopy issue on Linux 4.19
Get Started | Docker Documentation all the way to Swarm, Stack and Deployment
Docker overview | Docker Documentation
Engineering Archives - Docker Blog
A beginner’s guide to Docker — how to create your first Docker application
Docker Jumpstart
Docker Architecture
wsargent/docker-cheat-sheet: Docker Cheat Sheet
Docker 101 - how to get from creation to deployment
The Complete Docker Collection [Tutorials] - DZone Cloud
Docker Explained – An Introductory Guide To Docker - DZone Cloud
Demystifying Containers 101: A Deep Dive Into Container Technology for Beginners
5 part Docker series, beginner to master - DEV Community 👩💻👨💻 ❗!important
Docker Tutorial for Beginners - Hashnode
Tutorials – Docker » Linux Magazine
Getting Started with Docker | Scotch
Howto: Docker, Databases, and Dashboards to Deal with Your Data | Hackaday
Docker In A Nutshell – Coinmonks – Medium macOS setup
Learn Enough Docker to be Useful – Towards Data Science Part 1
Learn Enough Docker to be Useful – Towards Data Science Part 2
Learn Enough Docker to be Useful – Towards Data Science Part 3
Slimming Down Your Docker Images – Towards Data Science Part 4
A Docker Tutorial for Beginners
Learn Docker by Building a Microservice
Docker Tutorial: Containers, VMs, and Docker for Beginners - Level UpLevel Up
A Beginner-Friendly Introduction to Containers, VMs and Docker
Learn Enough Docker to be Useful – Towards Data Science
alexellis/HandsOnDocker: Get hands-on with Docker through a dozen self-paced and progressive labs.
Docker Basics - Amazon EC2 Container Service
Creating a Cross-platform Docker Development Environment | via @codeship
In Docker, what's the difference between a container and an image? - Stack Overflow
Docker image vs container - Stack Overflow
How to Automate Docker Deployments image, container and image maintenance
Docker —— 从入门到实践
Docker 中文教程
全面易懂的 Docker 指令大全
Docker 问答录(100 问) · 大桥下的蜗牛
Should I use Vagrant or Docker.io for creating an isolated environment? - Stack Overflow
Docker Do's And Don'ts | devo.ps
Vagrant, Docker and Ansible. WTF? | devo.ps
Docker Tutorial Series | iRomin
docker - Head in the clouds...
jmkhael/docker-playground: Docker playground used in the Docker blog serie
10 Free Courses to Learn Docker for Programmers and DevOps Engineers
CenturyLink Labs - How to Use Docker, CoreOS, Linux Containers, Cloud
Home - CenturyLink Cloud Developer Center
Blog :: Glider Labs
Bitnami Stacksmith
Jessie Frazelle's Blog: Home
Container42 · Stuff I find interesting
50+ Useful Docker Tools | Caylent
Dockerize-Me – WirelessMoves
52-technologies-in-2016/39-docker
52-technologies-in-2016/40-docker-cron
52-technologies-in-2016/42-docker-compose
Play-with-docker
Play with Docker Classroom
play-with-docker/training
play-with-docker/play-with-docker.github.io: Play with docker class-room repo
Use of Docker Playground - GeeksforGeeks
Play with Docker
play-with-docker/play-with-docker: You know it, you use it, now it's time to improve it. PWD!.
docker/labs: This is a collection of tutorials for learning how to use Docker with various tools. Contributions welcome.
labs/dockercon-us-2017 at master · docker/labs
jpetazzo/orchestration-workshop ❗!important
Videos
DockerCon EU 2017: All the videos are now live! - Docker Blog
DockerCon Europe 2017 Videos
DockerCon Europe 2017 - YouTube
DockerCon EU 2017 Moby Summit - YouTube
DockerCon SF 2018
Docker Tutorial for Beginners | Docker Full Course | Access to FREE LABS [No Ads] - YouTube 2019 KodeKloud
Docker Tutorial for Beginners - A Full DevOps Course on How to Run Applications in Containers - YouTube 2019 freeCodeCamp.org
Docker Learning Series - YouTube
Docker for the Absolute Beginners - YouTube
Docker Tutorial for Beginners - A Full so Course on How to Run Applications in Containers - YouTube
The right way to Docker - YouTube
you need to learn Docker RIGHT NOW!! // Docker Containers 101 - YouTube
Production
The Containerizers - YouTube
Docker features and tools by Tom Verelst - YouTube
Introduction to Docker - YouTube by dotCloud founder in 2013
Taking Docker to Production: What You Need to Know and Decide - DockerCon Europe 2017 Videos
History
A Not Very Short Introduction to Docker - Jayway
How Docker Was Born | StackShare
How Docker Fits Into The Current DevOps Landscape | StackShare
How Docker Manages Its Massive Open Source Project | StackShare
Docker started out using LXC, then docker/libcontainer, then opencontainers/runc
Docker drops LXC as default execution environment
Docker and Broad Industry Coalition Unite to Create Open Container Project | Docker Blog
Containerd: a daemon to control runC | Docker Blog
Internals
Docker components explained
Docker, Containerd & Standalone Runtimes — Here’s What You Should Know | by Aymen Eon Amri | FAUN
This Is How Docker Works, The Fun Way! - YouTube
#perfmatters
Measuring Docker IO overhead - MySQL Performance Blog
Measuring Percona Server Docker CPU/network overhead - MySQL Performance Blog
HPE and Docker Reference Configuration for infrastructure optimization using Docker containers on... • Droplr™
Why Docker
Why Docker | Docker
Why Docker?
Docker 1.0 brings container technology to the enterprise | ZDNet
CI, CD with Docker, Jenkins and Tutum | Sreenivas Makam's Blog mostly "why Docker"
Who's using Docker? | Opensource.com
Immutable Awesomeness - Josh Corman and John Willis at DevOps Enterprise Summit 2015 - YouTube
Ambassador pattern
Link via an ambassador container
Docker Grand Ambassador · Container42
Deploying Multi-Server Docker Apps with Ambassadors - CenturyLink Cloud Developer Center
CenturyLinkLabs/ctlc-docker-ambassador
dockerfiles/ambassador at master · SvenDowideit/dockerfiles
gliderlabs/connectable: Magic proxy for internal services
Ambassador pattern: if App container depends on Database container, always create the Database container on the same Docker host and link it to the App container. Whether the Database container is the real database or a proxy of a remote service is an implementation detail of the operation team.
Link via an ambassador container
Manageacloud
Dockerising Puppet | Official Manageacloud blog
Deploying Containers using Docker Compose | Official Manageacloud blog
Phusion
Baseimage-docker, fat containers and "treating containers as VMs"
Baseimage-docker: A minimal Ubuntu base image modified for Docker-friendliness
Linuxserver.io
Linuxserver.io - There's no place like 127.0.0.1
Building software from source using Docker – Linuxserver.io
Nordic APIs
Docker Containers and APIs: A Brief Overview | Nordic APIs |
API-Driven DevOps: Spotlight on Docker | Nordic APIs |
InfoQ
深入浅出 Docker - InfoQ
Docker - InfoQ cn
Docker - InfoQ
Docker 三年回顾:梦想依在,人生正当年
Easier, Better, Faster, Safer Deployment with Docker and Immutable Containers
DigitalOcean
Docker Tutorials | DigitalOcean
Docker Explained: Using Dockerfiles to Automate Building of Images | DigitalOcean
The Docker Ecosystem | DigitalOcean
Docker Explained: How To Containerize and Use Nginx as a Proxy | DigitalOcean
Network
With Swarm mode's multi-node overlay network and service discovery built-in, I consider linking container on single host over
bridge
network obsolete.
Use Docker's overlay by default, for complex use cases seekubernetes#cni
Connection refused? Docker networking and how it impacts your image fundamental, network interfaces, listen on 0.0.0.0
Networking Overview | Docker Documentation
Docker - Docker Reference Architecture: Designing Scalable, Portable Docker Container Networks about Docker Swarm
Ports bound by container are managed by the process docker-proxy
for port forwarding.
Use netstat -nlt
to list all listening TCP ports in numeric format.
docker network connect <network> <container>
docker network disconnect <network> <container>
Docker networking is CRAZY!! (you NEED to learn it) - YouTube
Docker Networking Tutorial // ALL Network Types explained! - YouTube
Docker Networking Crash Course - YouTube
Docker Advanced Networking - YouTube
Docker Networking Design Philosophy | Docker Blog
Container Networking: A Breakdown, Explanation and Analysis - The New Stack
Docker Networking - Common Issues and Troubleshooting Techniques
Service Discovery and Load balancing Internals in Docker 1.12 – Sreenivas Makam's Blog DNS strategy explained with Docker Swarm
Docker for Ops: Docker Networking Deep Di
ve, Considerations and Troubleshooting - Docker Track - YouTube
Docker acquired SocketPlane to improve libnetwork, released with Docker 1.9 late 2015.
libnetwork/design.md at master · docker/libnetwork
docker/vlan-networks.md at master · docker/docker
Issues · docker/libnetwork
libnetwork issues:
MacVLAN. A network locks the gateway ip preventing to assign it · Issue #1447 · docker/libnetwork
UDP failure, fixed in 17.05
Failed to receive UDP traffic after container restart · Issue #8795 · moby/moby
Conntrack flush support by fcrisciani · Pull Request #32505 · moby/moby
Four ways to connect a docker container to a local network - Odd Bits
Odd Bits - Using Docker macvlan networks
Kubernetes: Why Kubernetes doesn’t use libnetwork
Docker used libnetwork and Container Network Model (CNM), which are tightly coupled with Docker Engine. appC used Container Network Interface (CNI), which plays along with other ecosystem.
Understanding Docker – Network Namespaces – zwischenzugs
Introduction to Linux Network Namespaces - YouTube
记一次 Kubernetes/Docker 网络排障 | 酷 壳 - CoolShell
Docker tutorial: Get started with Docker networking | InfoWorld
Tungsten
Home - Tungsten Fabric = Contrail
What is the Juniper Contrail Controller? — SDxCentral.com
Contiv
Contiv
Container Networking with Project Contiv - YouTube
Contiv on Docker swarm mode using VLAN (L2) networking - YouTube
Cilium
Cilium - Linux Native, API-Aware Networking and Security for Containers eBPF based
cilium/cilium: eBPF-based Networking, Security, and Observability
Introduction to Cilium — Cilium documentation
Linux kernel holds key for advanced container networking | InfoWorld
Flannel
coreos/flannel: flannel is a network fabric for containers, designed for Kubernetes
Calico
Project Calico - Secure Networking for the Cloud Native Era
projectcalico/canal: Policy based networking for cloud native applications Calico + flannel, DEPRECATED
Installing Calico for policy and flannel for networking
Calico for Kubernetes networking: the basics & examples
Weave
Docker container networking monitoring - Weaveworks
Weaveworks GitHub org
weaveworks/weave: Simple, resilient multi-host Docker networking
Weave Discovery and Docker Swarm - Weaveworks
Using Nginx as a reverse proxy/load balancer with Weave and Docker - Weaveworks
Submariner
Cross-Cluster Network Connectivity for Kubernetes | Submariner CSI compatible
Announcing Submariner, Multi-Cluster Network Connectivity for Kubernetes
Rancher Labs Launches Submariner Networking Project for Kubernetes - Container Journal
Introducing Submariner: Multi-Cluster Network Connectivity
Nebula
Introducing Nebula, the open source global overlay network from Slack
slackhq/nebula: A scalable overlay networking tool with a focus on performance, simplicity and security
Volumes
Use volumes | Docker Documentation
Comprehensive Overview of Storage Scalability in Docker – Red Hat Developer Blog
Where are Docker images stored? - Lounge Scene
Understanding Volumes in Docker - Container Solutions
Walkthrough: Docker Volumes vs Docker Volumes with Flocker · ClusterHQ
How To Share Data between Docker Containers | DigitalOcean
How To Share Data between the Docker Container and the Host | DigitalOcean
Working with Docker Volumes
Containerizing stateful applications | InfoWorld
Docker tutorial: Get started with Docker volumes | InfoWorld
Docker Containers and Persistent Data – Ravindu N Fernando – Medium
Docker In-depth: Volumes · Container42
Persistent volumes with Docker - Data-only container pattern · Container42
Data-only container madness · Container42
dockerfile - Docker: Mount directory from one container to another - Stack Overflow data only container and --volumes from
Named volumes replaces data-only containers since 1.9.
What is the (best) way to manage permissions for docker shared volumes - Stack Overflow
Docker Webinar Q&A: Persistent Storage & Docker - Docker Blog
Part 1: Docker Basics: Understanding Union Filesystems, Storage and Volumes - docker
Part 2: Docker Storage Considerations - docker
Part 3: Persistent Storage, Data and Docker - docker
Use Docker Engine Volume plugins | Docker Documentation
Martin Heinz - Deep Dive into Docker Internals - Union Filesystem
templated volume name syntax not supported in compose v3 format? · Issue #30770 · moby/moby using templated volume name in swarm mode
# create data volume
docker create -v /var/lib/mysql --name data-mysql busybox /bin/true
# copy data files to /backup
docker run --volumes-from data-mysql mysql
# copy data files to /backup
docker run --rm --volumes-from data-mysql -v HOST_BACKUP:/backup -it busybox sh
gdiepen/docker-convenience-scripts docker_clone_volume.sh
Nfs4 Docker Stacks - flavio.aiello.ch
SELinuz
On SELinux (Fedora/Centos), add :Z
to mount option
Permission denied on accessing host directory in Docker - Stack Overflow
Permission denied
when trying to access volume while selinux-enabled=true · Issue #33389 · moby/moby
D4M 17.04.0-ce-rc2-mac6 (16165): Volume labels no longer accepted in stack file · Issue #32579 · moby/moby however this fix is not available for service
SELinux blocks bind mount with Docker Compose · Issue #10779 · containers/podman :Z,U
or chcon -Rt container_file_t PATHTOHOSTDIR
/chcon -Rt svirt_sandbox_file_t PATHTOHOSTDIR
on host
Set the selinux status to Permissive
, still can not run docker - Stack Overflow change option in /etc/sysconfig/docker
to --selinux-enabled=false
Storage
Docker started out using AUFS (a union file system) for storage, but AUFS didn't make it into mainstream Linux kernel. Many distro now uses device mapper or the new OverlayFS.
Docker storage drivers | Docker Documentation
About images, containers, and storage drivers | Docker Documentation
Docker Basics Webinar Q&A: Understanding Union Filesystems, Storage and Volumes | Docker Blog
Docker storage 101: How storage works in Docker
Docker Storage: An Introduction - via @mazembo | via @codeship
Jessie Frazelle's Blog: The Brutally Honest Guide to Docker Graphdrivers
Docker Storage Drivers
Docker for Ops: Docker Storage and Volumes Deep Dive and Considerations - Docker Track - YouTube
3rd Party Storage Drivers
Docker Persistent Volumes » ADMIN Magazine
REX-Ray docs 😴inactive
rexray/rexray: REX-Ray is a container storage orchestration engine enabling persistence for cloud native workloads
rancher/convoy: A Docker volume plugin, managing persistent container volumes. DEPRECATED
ContainX/docker-volume-netshare: Docker NFS, AWS EFS, Ceph & Samba/CIFS Volume Plugin 😴inactive
ClusterHQ/flocker: Container data volume manager for your Dockerized application 😴inactive
ClusterHQ shut down in 2016-12
Docker Engine API
Communicate to Docker Engine with HTTP API via unix:///var/run/docker.sock
Develop with Docker Engine SDKs and API | Docker Documentation
Examples using the Docker Engine SDKs and Docker API | Docker Documentation
Engine API version history | Docker Documentation
Docker Engine API Reference
moby/client - GoDoc
Docker SDK for Python — Docker SDK for Python documentation
apocas/dockerode: Docker Remote API Node.js Client module
fsouza/go-dockerclient: Go client for the Docker remote API.
Docker Registry
The Docker Hub is the official hosted registry service by Docker for building and shipping application or service containers. Automated Builds can build image upon repo change. The problem is it requires R/W access to all user repo and it does not have good track record.
Docker Hub
Introducing Docker Hub
Integrating Docker Hub In Your Application Build Process | Linux.com | The source for Linux information
Introducing the Docker Index: Insight from the World’s Most Popular Container Registry - Docker Blog
An Overview of Docker Registries - via @codeship | via @codeship
Rancher Labs | Comparing Four Hosted Docker Registries | Rancher Labs
Docker Registries: the Good, the Bad & the Ugly
Docker Tip #50: Running an Insecure Docker Registry — Nick Janetakis
Hosted Docker Registry | Deploy Docker Container | Rancher
Container Registries You Might Have Missed hosted and self-hosted
Quay also provides hosting of Docker images and automated builds.
MicroBadger Link your Docker image and the
source it was built from
Docker Hub Automated build
Configure automated builds on Docker Hub | Docker Documentation
To trigger the automated build:
- push empty commit to your repo; OR
- go the
Docker Registry
You can host your own Docker Registry.
Deploy a registry server | Docker Documentation
Configuring a secure private registry
Sharing a local registry with minikube – Hasura
Your own private docker registry with digitalocean and caddy
Rancher 2 Private Docker Registry? - Rancher 2.x - Rancher Forums
Docker Engine would not pull from non TLS registry by default, do use HTTPS.
You have to add your self-signed cert to Docker daemon AND restart it to be able to pull from private registry.
docker/distribution: The Docker toolset to pack, ship, store, and deliver content Distribution = Registry v2, the new implementation
library/registry - Docker Hub
BlackGlory/caddy-proxy: Automated caddy proxy for Docker containers using docker-gen
tumblr/docker-registry-pruner: Tool to apply retention logic to docker images in a Docker Registry
docker run -d -p 5000:5000 \
-v $(pwd)/config.yml:/etc/docker/registry/config.yml \
--name=docker_registry \
registry:2
Portus authorization service for your Docker registry
On Swarm Mode setup, each node can use the Registry at localhost:5000
.
Deleting images
Docker Registry 2.0 - how to delete unused images? - Stack Overflow
Garbage collection | Docker Documentation
Deleting images is a bit trickery, you have to enable the config, use digest to DELETE, and manually run GC
burnettk/delete-docker-registry-image: If you are running a private v2 docker registry, and you are storing your data on disk, running this script from the machine where the data lives will let you fully delete an image or tag
Harbor
Harbor
Locking Down Kubernetes Security, Compliance with Harbor - YouTube
Harbor Registry is VMware's answer for hosting Docker images. This registry is built on the foundation of Docker Distribution, but it adds security and identity-management features. It also supports multiple registries on a single host.
Locking Down Kubernetes Security, Compliance with Harbor - The New Stack
Notable Images
docker-library/official-images: Docker Official Images
- docker-dev
- ubuntu, phusion/baseimage/
- google/debian
- wordpress
- node cusspvz/node/
- redmine sameersbn/docker-redmine
- jenkins
- cptactionhank/atlassian-jira-software
- gitlab/gitlab-ce
- mariadb
Introducing Deep Learning Containers: Consistent and portable environments | Google Cloud Blog
How to Dockerize Machine Learning Applications Built with H2O, MLflow, FastAPI, and Streamlit | by Kenneth Leung | Jun, 2022 | Towards Data Science
cusspvz/node.docker: Super small Node.js container (~15MB) based on Alpine Linux OS
BretFisher/node-docker-good-defaults: sample node app for Docker examples
renoirb/nginx-http2-luajit/
ficusio/openresty/
openresty/openresty
nicolaka/netshoot: a Docker + Kubernetes network trouble-shooting swiss-army container
jgamblin/tcpdump/ post
ironPeak services
ironPeakServices/iron-redis: Secure base image for running Redis.
ironPeakServices/scratch-go: Secure base image for running Go applications.
u/sameersbn/ many useful CaaS and great instructions
u/dperson/ many useful CaaS and great configuration script
r/phusion/ of the Passenger fame
u/centurylink/
centurylink/buildpack-runner/
u/linuxserver/ source
Images built by us - LinuxServer
r/bitnami/
Bitnami Container Images for Docker
Bitnami on GitHub
bitnami-docker/subrion.md at master · bitnami/bitnami-docker tutorial with Docker Compose
dockerfiles/devel at master · tmc/dockerfiles
On the contrary
Docker Misconceptions tips/alternatives for using docker in production
A first look at docker.io | woah!
LXC containers are awesome, but Docker.io sucks | Cal Leeming Blog
boycott docker
The world of containers doesn't end with Docker | InfoWorld
App packaged as container is great for portability, but replication, scalability and security requires helping hands from a larger ecosystem.
The sad state of sysadmin in the age of containers "devops" deploy untrusted container in production is a bad thing
Koding’s Migration From Containers to Virtual Machines | Software Engineering Daily
Installation
you do need latest Docker, the one in you distro is probably outdated
Arch Linux users should use the one in official repo
# install script for most Linux distro
# > I now recommend install from package!!
# !! need su !!
curl -fsSL https://get.docker.com/ | sh
systemctl enable --now docker
usermod -aG docker $(id -un)
docker -v # should >= 17.05
# https://github.com/docker/compose/releases
curl -L https://github.com/docker/compose/releases/download/1.24.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod a+x /usr/local/bin/docker-compose
# https://github.com/docker/machine/releases
curl -L https://github.com/docker/machine/releases/download/v0.16.1/docker-machine-`uname -s`-`uname -m` > /usr/local/bin/docker-machine
chmod a+x /usr/local/bin/docker-machine
Install Docker Engine
Get Docker CE for ubuntu | Docker Documentation Install from package (this is troublesome after the package split in 18.09)
https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/
Install Docker PPA on Ubuntu 16.04 With Good Defaults
How To Install and Use Docker on Ubuntu 18.04 | DigitalOcean check repo used
Docker - ArchWiki
Windows/Mac
Docker Desktop for Mac and Windows | Docker Windows Server 2016 support Docker natively
Docker - Installation on Windows - GeeksforGeeks 2021-09
What you need to know about Docker in Windows | InfoWorld
Build and run your first Docker Windows Server container - Docker Blog 2016-09
How to set up Docker and Windows Subsystem for Linux: A Love Story. 💚
Rancher Desktop Docker Desktop alternative
Under the Hood: Demystifying Docker For Mac CE Edition – Collabnix
Top 5 Exclusive Features of Docker For Mac That You Can’t Afford to Ignore – Collabnix
Context Switching Made Easy under Kubernetes powered Docker for Mac 18.02.0 – Collabnix
Quickstart
Get Started, Part 1: Orientation and setup | Docker Documentation
A crash course on Docker — Learn to swim with the big fish
docker pull ubuntu:14.04
# created an interactive named container
docker run -it --name ubuntu ubuntu:14.04 bash
# mounting your home and use it as working directory
docker run -it -v /home/user:/home/user -w /home/user ubuntu:14.04 bash
# a read-only container with ram drives
docker run --read-only --tmpfs /run --tmpfs /tmp -it ubuntu:14.04 /bin/bash
Docker CLI
Use the Docker command line
Config and aliases can be stored in ~/.docker/config.json
Docker Basic Command | Fast Deploying Systems With Docker
wsargent/docker-cheat-sheet: Docker Cheat Sheet
j-bennet/wharfee: A CLI with autocompletion and syntax highlighting for Docker commands.
CLI Tips and Tricks (From Docker Online Meetup)
10 Tips & Tricks with Docker - Mercure News
jmkhael/make-for-docker: Makefile to ease our Docker commands - http://jmkhael.io/makefiles-for-your-dockerfiles/
j-bennet/wharfee: A CLI with autocompletion and syntax highlighting for Docker commands.
docker run IMAGE [CMD]
: create an container and execute command
docker create IMAGE
: create an container
docker exec CONTAINER CMD
: execute command in a running container
docker port CONTAINER
: list port mappings
docker ps
: list started containers
docker ps -as
: list all containers, with size (slower)
docker images
: list all images
docker cp
: copy file between a container and the host
docker rm CONTAINER
: remove container
docker rmi IMAGE
: remove image
Image
Get Started, Part 2: Containers | Docker Documentation
Today I Learned: Pull Docker Image from GCR (Google Container Registry) in any non-GCP Kubernetes… - By Iman Tumorang
Full image tag: [REGISTRYHOST/][USERNAME/]NAME[:TAG]
Image can be thought of as a static snapshot of a container.
docker build
: build Dockerfile
as image
docker history
: list layers and commands creating it
docker pull|push IMAGE
: pull/push image from/to Docker Hub (Automated Builds does this for git repo)
docker diff CONTAINER
: view changes to file system
docker commit CONTAINER IMAGE
: save container (with modification) as image
docker export CONTAINER
: export container as tarball (used for flattening layers)
docker import TAR
: create an image from docker
docker tag IMAGE TAG
: add image to namespace (user)
docker push IMAGE
: publish image to Docker Hub
docker save -o TAR IMAGE
: save image as tar
docker load -i TAR
: load local image
Difference between save and export in Docker – Thomas Uhrig
Moving Docker Containers and Images Around
TL;DR: save/load preserves layers and tags, export/import don't
docker run
Option | Remark |
---|---|
-it | create an interactive TTY; Ctrl + P, Ctrl + Q to from it |
-v SRC:TARGET | mount volume to container, SRC can be an absolute path on Docker Host or a Docker volume name |
-w | specify working directory |
-p P1:P2 | map host's port P1 to port P2 in container, omitting P1 to bind to random Host port |
-P | publish all exposed ports to random ports on host |
-e | set environment variable |
-h | set hostname of container |
-l | set label of container |
-a | attach to a running container |
-d | run container in detached mode, returns CONTAINER_ID; docker attach CONTAINER to attach to it later |
--rm | remove container upon exit |
--read-only | make RFS read only |
Docker API
Docker daemon exposed Docker API via UNIX socket at: unix:///var/run/docker.sock
How to Get Started Using the Docker Engine API
Logging
Configure logging drivers | Docker Documentation
Local File logging driver | Docker Documentation
Use a logging driver plugin | Docker Documentation
Docker Logging: How Do Logs Work With Docker Containers? | LogicMonitor
Builder
old builder will be deprecated, update to buildx
Overview of Docker Build
Dockerfile reference
Best practices for writing Dockerfiles | Docker Documentation
Container Best Practices: What They Are and Why You Should Care – The New Stack
hexops/dockerfile: Dockerfile best-practices for writing production-worthy Docker images.
Haskell Dockerfile Linter
Builder log (annotated):
Sending build context to Docker daemon 2.048kB
Step 1/3 : FROM ubuntu:xenial
---> 747cb2d60bbe # image ID
Step 2/3 : RUN touch /tmp/foo
---> Running in 123624a3b7e7 # container ID
---> bb7b8fc505de # committed image ID
Step 3/3 : RUN touch /tmp/bar
---> Running in a595d46e5ea5 # container ID
---> 8e1a34ff9fb7 # committed image ID
Removing intermediate container 123624a3b7e7
Removing intermediate container a595d46e5ea5
Successfully built 8e1a34ff9fb7 # image ID to be tagged
Successfully tagged demo:latest
So you can actually docker run bb7b8fc505de ls /tmp
to see only foo
but not bar
.
This actually sets breakpoint in your Dockerfile for debugging.
image-spec/annotations.md at main · opencontainers/image-spec
Shipping Manifests, Bill of Lading and Docker - Metadata for Containers - YouTube slides
--label org.opencontainers.image.created=$(date --iso-8601=s)
--org.opencontainers.image.revision=$(git rev-parse HEAD)
Dockerize: A tiny replacement for Dockerfiles
Dockerfile Best Practices
Dockerfile Best Practices - take 2
Understanding and Creating Effective Docker Images - DZone Cloud
Common Dockerfile Mistakes - Atlassian Developers
9 Common Dockerfile Mistakes - Runnablog
Gotchas in Writing Dockerfile | kim hirokuni
Docker cache and apt-get update. – Dat's homepage update
and install
in the same RUN
Jonathan Bergknoff: Building Good Docker Images
Guidance for Docker Image Authors — Project Atomic
Do not ignore .dockerignore (it's expensive and potentially dangerous) - Codefresh
Unprivileged Docker Builds – A Proof of Concept – zwischenzugs
Caching Docker Images - CenturyLink Cloud Developer Center
Optimizing Docker Images - CenturyLink Cloud Developer Center
How to Maximize Your Docker Image Caching Techniques - CenturyLink Cloud Developer Center
Dockerfile: ADD vs COPY - CenturyLink Cloud Developer Center
ARG and ENV
Docker ARG, ENV and .env - a Complete Guide · vsupalov
Arguments and variables in Docker – manifoldco
Docker Environment Configs, Variables, and Entrypoints | DevOps and Docker Talk
Build Secrets
Build secrets and SSH forwarding in Docker 18.09 – Tõnis Tiigi – Medium
Docker build secrets, the sneaky way
Multi-stage builds
BuildKit's Dockerfile support multiple build contexts
Use multi-stage builds | Docker Documentation
Advanced Dockerfiles: Faster Builds and Smaller Images Using BuildKit and Multistage Builds - Docker Blog
Builder pattern vs. Multi-stage builds in Docker
Docker build patterns — Matthias Noback - Blog
Straightforward multi-stage build with a single Dockerfile (and a Makefile)
Advanced multi-stage build patterns – Tõnis Tiigi – Medium
Lightweight Docker images with Alpine – Anuradha Weeraman | Blog
Using docker multi-stage builds for deploying front-end
Leveraging Multi-stage Builds to use a Single Dockerfile for Dev and Prod – mikesir87's blog
Can You Mount a Volume While Building Your Docker Image to Cache Dependencies? · vsupalov Use intermediate image
Modern ways
The hunt for a better Dockerfile
Are Dockerfiles good enough?
Building containers without Docker
Buildkit (new builder)
BuildKit
moby/buildkit: concurrent, cache-efficient, and Dockerfile-agnostic builder toolkit
Install Docker Buildx
docker buildx
docker/buildx: Docker CLI plugin for extended build capabilities with BuildKit dokcer buildx
invokes Buildkit
DOCKER_BUILDKIT=1 docker build .
# or install `docker-buildx` with package manager
buildkit/reference.md at master · moby/buildkit new syntax in Dockerfile 1.4
buildkit/buildkit.go at master · moby/buildkit build script in Go
docker/dockerfile - Docker Image | Docker Hub
Using Docker Buildx to Create Cross-Platform Docker Images for Seamless Compatibility - DEV Community
Martin Heinz - Building Docker Images The Proper Way 2021-02, BuildKit (dockerfile:experimental
), can use dockerfile:1.4
now
Dockerfiles now Support Multiple Build Contexts - Docker
Introduction to heredocs in Dockerfiles - Docker Blog
Cutting Build Time In Half with Docker’s Buildx Kubernetes Driver
Buildah
Buildah | buildah.io
containers/buildah: A tool that facilitates building OCI images
buildah/demos at main · containers/buildah
Getting started with Buildah | Red Hat Developer
Buildah: Build containers fast and easy without Docker - JAXenter
Unprivileged Docker Builds – A Proof of Concept – zwischenzugs
Build containers in GitLab CI with buildah :: major.io
buildah error: vfs driver does not support overlay.mountopt options :: major.io
ansible-community/ansible-bender: ansible-playbook + buildah = a sweet container image
Build and run Buildah inside a Podman container - Red Hat Developer Blog
Image Analysis
MicroBadger
https://microbadger.com/images/openjdk:11-slim
Docker Layers Explained - DZone Cloud
wagoodman/dive: A tool for exploring each layer in a docker image
shaded-enmity/docker-doug: DOUG - DOcker Update Guard
Introducing container-diff, a tool for quickly comparing container images | Google Open Source Blog
GoogleContainerTools/container-diff: container-diff: Diff your Docker containers
CenturyLinkLabs/dockerfile-from-image
Container Image Immutability and the Power of Metadata - via @codeship | via @codeship
Explaining Docker Image IDs
MicroBadger
Finding the layers and layer sizes for each Docker image - Stack Overflow
docker history IMAGE
docker history --no-trunc IMAGE
Builder (3rd party)
GoogleContainerTools/kaniko: Build Container Images In Kubernetes
Building Docker images with Kaniko – Sebastien Goasguen – Medium
Tiny Image
Create the smallest possible Docker container | Xebia Blog with statically linked Go executables
How to create the smallest possible docker container of any image | Xebia Blog
Simplify the Smallest Possible Docker Image – Adriaan de Jonge – Medium
Building Docker Images for Static Go Binaries — Medium
Slim application containers (using Docker) | fosiki
How to build an optimal Docker image for your application? - Event-Driven.io
Reducing Your Docker Image Size - via @codeship | via @codeship
Optimizing Docker Images - CenturyLink Cloud Developer Center
Optimizing Docker image size and why it matters - contains.dev
Alpine Linux: Lightweight Docker Java Images | Takipi Blog
Refactoring a Dockerfile for image size
3 simple tricks for smaller Docker images ♦︎ Learnk8s
SlimToolkit - Optimize Your Containerized App Dev Experience. Better, Smaller, Faster and More Secure Containers Doing Less! Slim Docker Container Images by up to 30x. · SlimToolkit
slimtoolkit/slim: Slim(toolkit): Don't change anything in your container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
William-Yeh/docker-mini: Quest for minimal Docker images: slides and lab materials.
Squashing Docker Images ·
jwilder/docker-squash: Squash docker images to make them smaller
docker commit; docker save image | docker-squash -t newtag | docker load
aidanhs/dlgrab: docker layer grabber
djosephsen/skinnywhale: Skinnywhale helps you make smaller (as in megabytes) Docker containers
mvanholsteijn/strip-docker-image: Utility to strip Docker images to their bare minimum size.
Blitznote/debase: 📦 minimal Ubuntu for containers, with curl and support for TLSv1.3
Inside Docker's "FROM scratch" · Do not go gentle into this good night. Rage.
Create lightweight Docker containers with Buildroot | Docker Blog
Introducing gockerize | AeroFS
redbooth/gockerize: Package golang service into minimal docker containers.
Don't Put Fat Jars in Docker Images
GoogleContainerTools/jib: 🏗 Build container images for your Java applications.
On the contrary:
Docker Containers: Smaller is not always better » Ramblings
distroless
GoogleContainerTools/distroless: 🥑 Language focused docker images, minus the operating system.
distroless/README.md at master · GoogleContainerTools/distroless
2017 swampUP Sessions | Distroless Docker: Containerizing Apps, not VMs - Matthew Moore - YouTube
Stories of My Experiments with "Distroless" Containers
Containerizing Build environment
Habitus |Build Flow Tool for Docker
cisco/elsy: An opinionated, multi-language, build tool based on Docker and Docker Compose
Crafting perfect Java Docker build flow - Codefresh
redbooth/gockerize: Package golang service into minimal docker containers.
My Favorite Way To Handle Dev Environments | VS Code Devcontainers - YouTube
my presentation and repo
Iron.io
Microcontainers: Iron.io's New Hack to Shrink Docker Containers - The New Stack
Microcontainers - Tiny, Portable Docker Containers | Iron.ioIron.io
An Easier Way to Create Tiny Golang Docker Images | Iron.ioIron.io
Prodution Images
A Simple Way To Dockerize Applications ·
jwilder/dockerize: Utility to simplify running applications in docker containers not actively maintained
powerman/dockerize: Utility to simplify running applications in docker containers successor
Java inside docker: What you must know to not FAIL - Red Hat Developer Blog
datastack-net/dockerized: Run popular commandline tools within docker
Node.js
Npm (or Yarn) Install within a Docker Container, the Right Way tips are actually not Node.js specific
An Exhaustive Guide to Writing Dockerfiles for Node.js Web Apps
Trick: How to significantly reduce NPM download time for NodeJS Web application on Docker image
Top 4 Tactics To Keep Node.js Rockin’ in Docker - Docker Blog
Python
Production-ready Docker images
Cache for python pip downloads and wheels in Docker
Dockerizing a Python 3 Flask App Line-by-Line – BitCraft – Medium
Python Poetry for Building Docker Images - Binx
Tips and Tricks
Docker - Application Guides
Introducing Docker Application Guides - Docker Blog
Improve your Docker workflow with this VS Code extension - DEV Community 👩💻👨💻
15 Docker Tips in 15 Minutes - YouTube
8 great tools that make Docker better | InfoWorld
Tips and Tricks of the Docker Captains - YouTube
You're doing it wrong: 5 common Docker mistakes | InfoWorld
Docker Performance Improvement: Tips and Tricks
Everyday Hacks for Docker - Codefresh
DockerCon 2015: Container Hacks in Docker | via @codeship
How to live inside a docker container? | Tit Petrič
Docker features for handling Container’s death and resurrection | Sreenivas Makam's Blog
Docker healthchecks: why you shouldn't use curl
or iwr
| Elton Stoneman
My Favourite Docker Tip – zwischenzugs add commands in container to history
Check Docker logs:
sudo journalctl -u docker
docker events
Rootless Docker
How to Run Docker in Rootless Mode - The New Stack
Experimenting with Rootless Docker - Tõnis Tiigi - Medium
Docker 19.03 introduces an experimental rootless Docker mode | Packt Hub
[DockerCon 2019] Hardening Docker daemon with Rootless mode
Docker containers with root privileges – Neoteric – Software House
Docker Without Root Privileges - DZone Cloud
Run Docker nginx as Non-Root-User - DEV Community 👩💻👨💻
Understanding Docker container escapes | Trail of Bits Blog
Environment variable from files
If you already have a ENV_FILE
, with key=value
per line.
In entrypoint.sh
:
. ${ENV_FILE}
export $(cut -d= -f1 ${V})
# .env loading in the shell
dotenv () {
set -a
[ -f ${ENV_FILE} ] && . ${ENV_FILE}
set +a
}
bash - How to export variables from a file? - Unix & Linux Stack Exchange
bash - Set environment variables from file - Stack Overflow
How to implement runtime environment variables with create-react-app, Docker, and Nginx
If you want to load independent variable from different file (docker secret
compatible):
#!/bin/bash
#
set -euo pipefail
# usage: file_env VAR [DEFAULT]
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
# (will allow for "$XYZ_DB_PASSWORD_FILE" to fill in the value of
# "$XYZ_DB_PASSWORD" from a file, especially for Docker's secrets feature)
file_env() {
local var="$1"
local fileVar="${var}_FILE"
local def="${2:-}"
if [ "${!var:-}" ] && [ "${!fileVar:-}" ]; then
echo >&2 "error: both $var and $fileVar are set (but are exclusive)"
exit 1
fi
local val="$def"
if [ "${!var:-}" ]; then
val="${!var}"
elif [ "${!fileVar:-}" ]; then
val="$(< "${!fileVar}")"
fi
export "$var"="$val"
unset "$fileVar"
}
envs=(
database__connection__host
database__connection__user
database__connection__password
database__connection__database
)
haveConfig=
for e in "${envs[@]}"; do
file_env "$e"
if [ -z "$haveConfig" ] && [ -n "${!e}" ]; then
haveConfig=1
fi
done
Support docker secrets for setting environment variables · Issue #125 · docker-library/ghost
Docker environment variables expanded from secrets – Basilio Vera – Medium
CMD
vs ENTRYPOINT
Dockerfile reference ENTRYPOINT
Dockerfile: ENTRYPOINT vs CMD - CenturyLink Cloud Developer Center
Docker ENTRYPOINT & CMD: Dockerfile best practices
docker - What is the difference between CMD and ENTRYPOINT in a Dockerfile? - Stack Overflow
Understanding Docker's CMD and ENTRYPOINT Instructions - via @codeship | via @codeship
Docker Tip #63: Difference between an Array and String Based CMD — Nick Janetakis
Array: exec form
String: shell form, can use pipe, shell gets PID 1
# default run invocation
# `ENTRYPOINT CMD` will be executed in container
docker run IMAGE CMD
# override ENTRYPOINT
docker run IMAGE --entrypoint ENTRYPOINT CMD
Default ENTRYPOINT
is /bin/sh -c
, you can override ENTRYPOINT
with --entrypoint
.
docker run
can specify (override) CMD
, akin to passing parameter to the executable specified by ENTRYPOINT
.
Docker Tip #63: Difference between an Array and String Based CMD — Nick Janetakis
docker run "IMAGE" "MULTIPLE COMMANDS" - Stack Overflow ["sh", "-c", "multiple CMD with &&"]
Running multiple commands in entrypoint · Issue #52 · docker-library/redmine can use multiline in Compose file
Executable Images
Executable Images - How to Dockerize Your Development Machine
Using Docker as a Personal Productivity Tool – Running Command Line Apps Bundled in Docker Containers | OUseful.Info, the blog...
Distributing Command Line Tools with Docker
If you wanted to add arguments to program (CMD
), the ENTRYPOINT
must be in JSON array notation.
# Dockerfile
# ...
ENTRYPOINT ["binary", "--"]
CMD ["--help"]
Specify uid
,gid
Use -u
to specify theuid
,gid
in container.
docker run -it --rm \
-u $(id -u):$(id -g) \
-v $(pwd):/tmp \
busybox sh
docker run -it --rm \
-u $(id -u):$(id -g) \
-v $(pwd):/build -w /build \
-v "$HOME/.m2":/.m2 \
maven:3-jdk-8-openj9 bash
Understanding how uid and gid work in Docker containers
How docker replaced my virtual machines and chroots - Gernot on developing Software generating image with ${USER}
managing users in docker · rocker-org/rocker Wiki
Deni Bertovic :: Handling Permissions with Docker Volumes
What is the (best) way to manage permissions for docker shared volumes - Stack Overflow
Work With Non-Root Containers for Bitnami Applications
Use user namespaces introduced in 1.10:
Init system
krallin/tini: A tiny but valid init
for containers built-in since 1.13+ and CE
Yelp/dumb-init: A minimal init system for Linux containers
Docker and the PID 1 zombie reaping problem
What is advantage of Tini? · Issue #8 · krallin/tini
Wait for service
vishnubob/wait-for-it: Pure bash script to test and wait on the availability of a TCP host and port
eficode/wait-for: ./wait-for is a script to wait for another service to become available. bash/alpine compatible
Supervisor connection refused
OverlayFS have problem creating Unix socket, add --tmpfs /var/run/
in docker run
.
https://github.com/Supervisor/supervisor/issues/654
https://github.com/moby/moby/issues/12080
User Namespaces
Remap a host user to root in container with --userns-remap
.
Docker - Introduction to User Namespaces in Docker Engine
Filesystem images and unprivileged containers [LWN.net]
User namespaces - Phase 2 · Issue #28593 · moby/moby
Failed to mount /sys/fs/cgroup when user namespace is enabled. · Issue #27629 · moby/moby
User namespaces don't work if there is a mount on /proc · Issue #26070 · moby/moby
docker --userns-remap @ubuntu 16.04 fails · Issue #22633 · moby/moby
Filtering
$ docker ps --filter "name=nostalgic"
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
715ebfcee040 busybox "top" 3 seconds ago Up 1 second i_am_nostalgic
9b6247364a03 busybox "top" 7 minutes ago Up 7 minutes nostalgic_stallman
673394ef1d4c busybox "top" 38 minutes ago Up 38 minutes nostalgic_shockley
$ docker images --filter=reference='busy*:*libc'
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox uclibc e02e811dd08f 5 weeks ago 1.09 MB
busybox glibc 21c16b6787c6 5 weeks ago 4.19 MB
# note the '/' is required
$ docker images --filter=reference='dpms/*'
REPOSITORY TAG IMAGE ID CREATED SIZE
dpms/dockbeat latest 316060f478d1 24 hours ago 134MB
dpms/monitor latest 23e0036ee085 4 days ago 1.25GB
Formatting
{% raw %}
# list mounted volumes
docker ps -aq | map docker inspect --format "{{.Name}} {{.Mounts}}"
# list network interfaces
docker ps -aq | docker inspect --format="{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}"
# show nodes and labels (Swarm mode)
docker node ls -q | \
xargs docker node inspect --format '{{.Description.Hostname}} {{with .Spec}}{{.Role}}({{.Availability}}) {{.Labels}}{{end}}'
{% endraw %}
add table
, json
(--format {{json .}}
) prefix for formatting the output
use json
directive to inspect fields if default output is table
Format command and log output | Docker Documentation
template - The Go Programming Language
Docker Inspect Template Magic - Container Solutions
Docker Quicktip #7: docker ps --format · Container42
politeauthority/docker-pretty-ps: Tired of that awful super wide 'docker ps' output? Go vertical! Try docker-pretty-ps!
Links to various formatting options can be found here.
Batch operation
Batch stop containers:
# in case admin script/orchestrator failed to stop the stack properly
docker ps -f "name=dpms19-*" -q | xargs -r docker rm -f
Batch remove images:
# this may not work if there is multiple tag pointing to the same image hash
docker images --filter=reference="project/*:3.3.*" -q | xargs -r docker rmi
# remove by label, requires `jq`
docker images -f reference="project/*:2.2.*" --format "{{json .}}" | jq '.Repository + ":" + .Tag' | xargs -L1 -r docker rmi
docker images -f reference="project/worker*" | awk 'NR>1 {print $1":"$2}' | xargs -L1 -r docker rmi
Find Dependent Child Images
linux - How to get the list of dependent child images in Docker? - Stack Overflow
Python3 script to find descendants of one or more docker images
ID=f50f9524513f
for i in $(docker images -q)
do
docker history $i | grep -q ${ID} && echo $i
done | sort -u
Moving Container between Hosts
Docker Over SSH - ITNEXT
docker-push-ssh · PyPI
遷移容器映像(Container Image)到另一台主機的各種作法 | The Will Will Web
# standard save, copy and load
docker save mycontainerimage | gzip > mycontainerimage.tar.gz
gunzip -c mycontainerimage.tar.gz | docker load
# ssh piping, docker load handles bzip automatically
docker save mycontainerimage | bzip2 | \
ssh root@server 'docker load'
Restart Policy
Ensuring Containers Are Always Running with Docker's Restart Policy - via @codeship | via @codeship
dexec
ahmetalpbalkan/go-dexec: It's like Go os/exec package but for Docker
Introducing dexec
Docker in Docker
jpetazzo/dind: Docker in Docker OBSOLETED by official docker image in dind
favor
Setting up a Docker Swarm cluster using Docker in Docker | Callista Enterprise
Setting up a Kubernetes cluster using Docker in Docker | Callista Enterprise
docker run --privileged -d docker:dind
docker run --privileged -it --rm docker:dind --storage-driver=$(docker info -f '{{.Driver}}')
docker run --privileged -it --rm --entrypoint sh docker:dind
# start a docker daemon in docker
docker run --privileged --name dind -d docker:dind
# docker clients using dind
docker run --link dind docker docker run -d nginx
docker run --link dind docker docker ps
One container to rule them all
- create containers from a container;
- allow a container to be able to interact with your overall Docker setup;
- implementation of a replication controller in a container
Using Docker-in-Docker for your CI or testing environment? Think twice.
For CI, the simple solution is o:
docker run -v /var/run/docker.sock:/var/run/docker.sock docker ...
But the container can mess with the host docker daemon.
Docker inside the CI runner? · Issue #9 · sameersbn/docker-gitlab-ci-runner
justone/dockviz
batch update docker images
docker images | grep -v '<none>' | awk 'NR>1 {print $1":"$2}' | xargs -L1 -r docker pull
cleanup Docker
# clean dangling images
docker rmi $(docker images -f dangling=true -q)
# clean images without tag
docker images -a --no-trunc | grep none | awk '{print $3}' | xargs -L1 -r docker rmi
# clean exited containers
docker ps -a --no-trunc | grep 'Exit' | awk '{print $1}' | xargs -L1 -r docker rm
# clean all containers
docker rm -f $(docker ps -aq)
docker system prune -f
spotify/docker-gc: Docker garbage collection of containers and images
What are Docker
How do I remove orphaned images? - Open Source Projects / DockerEngine - Docker Forums
Command to remove all unused images - General Discussions / Feature Requests - Docker Forums
Clean up after Docker by stefanXO
Docker Cleanup Scripts Comparison
Flatten layers
docker export
and docker import
This will merge the layers and make the image smaller.
Docker Source Code
docker/docker: Docker - the open-source application container engine
cli/
: the CLI
api/client/
: the commands
server/router
: REST API router
api/server/server.go
: the REST API server
dockerfile/builder.go
: Dockerfile parser
Docker 源码分析(一):Docker 架构
Docker 源码分析(二):Docker Client 创建与命令执行
Docker 源码分析(三):Docker Daemon 启动
Docker 源码分析(四):Docker Daemon 之 NewDaemon 实现
Docker 源码分析(五):Docker Server 的创建
Docker 源码分析(六):Docker Daemon 网络
Docker 源码分析(七):Docker Container 网络 (上)
Docker 源码分析(八):Docker Container 网络(下)
Docker 源码分析(九):Docker 镜像
Docker 源码分析(十):Docker 镜像下载
Docker 源码分析(十一):镜像存储
Container as System Service
Automatically start containers
Systemd vs. Docker [LWN.net]
OpenShift Origin - geard systemd
integration
systemd service file:
[Unit]
Description=Run pg
After=docker.service
Requires=docker.service
[Service]
Restart=always
RestartSec=30s
ExecStartPre=-/usr/bin/docker kill pg
ExecStartPre=-/usr/bin/docker rm pg
ExecStart=/usr/bin/docker run --rm --name pg --volumes-from pgdata postgres
ExecStop=/usr/bin/docker kill pg
ExecStartPost=-/usr/bin/docker rm pg
[Install]
WantedBy=multi-user.target
running GUI app in container
- install
xvfb
- in host,
xvfb :88 -screen 0 1366x768x24 -ac
- in container,
DISPLAY:88 firefox
如何在 Vagrant/Docker 中运行 Firefox | YL Notes
Docker Desktop: Your Desktop over ssh running inside of a Docker container | Docker Blog
Jessie Frazelle's Blog: Docker Containers on the Desktop
More Docker Doodlings – Accessing GUI Apps Via a Browser from a Container Using Guacamole | OUseful.Info, the blog...
BWC: GUI apps in Docker on OSX
Howto get hardware accelerated OpenGL support in Docker - Gernot on developing Software
Meet Webtops A Linux Desktop Environment In Your Browser | LinuxServer.io
linuxserver/webtop - LinuxServer.io
linuxserver/webtop - Docker Image | Docker Hub
Distrobox
"WSL for Linux", NO sandboxing
Distrobox | Use any linux distribution inside your terminal
89luca89/distrobox: Use any linux distribution inside your terminal. Enable both backward and forward compatibility with software and freedom to use whatever distribution you’re more comfortable with.
How to quickly deploy a Linux distribution with GUI applications via a container | TechRepublic
Distrobox: Try Multiple Linux Distributions via the Terminal
Toolboxes are not just for special cases
Distrobox Is Basically A Linux Subsystem For Linux - YouTube
Turning Distrobox Into Your Entire Linux Desktop - YouTube