Docker Cheat Sheet Update

Does anyone actually still care about Docker cheat sheets? All abstracted away by k8s & co.? Started with the promise to abstract "away" efforts on infrastructure and deployment, docker now itself got abstracted away by the resource hungry (in many regards) monster of k8s.

Fun fact: Instead of reducing (or even eliminating) the efforts for infrastructure and deployment (and having one guy - as before - or even zero guys - as promised) we now have two guys for it: the one doing the VMs and the one doing the containers.
Sad fact: Although everybody is using it, Docker almost went bankrupt - and lost support by k8s. Strange beast it is our economic (incentive) system ... it is not solutions, but indeed problems that create revenue and jobs.

Anyhow, in the last couple of weeks I stumbled several times over the old d&b Docker cheat sheet and so I now thought it is time for a (minor) update - after more than 5 years.

This is a list of the new entries:

Compute

  • list formatted: docker ps -a --format "table {{.ID}}\t{{.Names}}\t{{.Status}}\t{{.Ports}}"

  • use Environment Variables: see on StackOverflow

  • set multiple compose files manually as ENVIRONMENT VARIABLE: export COMPOSE_FILE="/path/to/docker-stack.yml:/path/to/docker-stack.dev.yml" ( more here )

  • use multiple compose or stack files for deploy:

    • optional (if stored as variable): echo "${ces_docker_stack_files}" # /path/to/docker-stack.yml -c /path/to/docker-stack.dev.yml
    • docker stack deploy -c $(echo "${ces_docker_stack_files}") ${COMPOSE_PROJECT_NAME} --with-registry-auth
  • list tasks of stack: docker stack ps "${COMPOSE_PROJECT_NAME}"

  • show logs of a stack service: docker service logs <service_name>

Network

  • create custom overlay network (encrypted): docker network create --opt encrypted --driver overlay <network_name>

Storage

Other

Security

  • create secret: docker secret create <sec_name> /path/to/<sec_file>
  • remove secret: docker secret rm <sec_name>
  • more here and here ... and same for configs

Docker Daemon Access

  • connect to remote docker daemon from a local shell: export DOCKER_HOST="ssh://<user>@<ip>"

Registry

  • login to registry: echo "${token}"| docker login registry.example.com --username "${user}" --password-stdin
  • logout from from registry: docker logout registry.example.com

Ingress

For all of those who made it down here (and did not get irritated by my introduction on Docker and k8s) these are two sources towards docker swarm as an enterprise data center orchestrator:
https://dockerswarm.rocks
https://gist.github.com/scyto/f4624361c4e8c3be2aad9b3f0073c7f9

And never forget: Those also still do exist and so keep looking out for their blogs, tools, and projects:
https://www.docker.com/community/captains/

Further Information

Github Link:
https://github.com/daten-und-bass/docker-cheat-sheet/blob/master/README.md