From personal use

  • tail logs : docker logs containername --tail 10
    • works also with relative time e.g --since 5m but more demanding
  • changing policy for reboot : docker update --restart=unless-stopped CONTAINEDID
  • entrypoint from docker-compose takes precedence over Dockerfile
  • with x11, image dorowu/ubuntu-desktop-lxde-vnc
  • curl --unix-socket /var/run/docker.sock http://localhost/containers/json | jq .[].Names
  • checking for updates via WatchTower docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower --run-once -d --monitor-only
  • podman as drop-in replacement
  • --add-host adding host IP as named host https://phillbarber.blogspot.com/2015/02/connect-docker-to-service-on-parent-host.html
  • docker stats --no-stream to see resource usage and if need be add constraints
  • docker network where withing a same network container can communicate by container names e.g. ping peertube
  • instead of docker rm $(docker ps -a -f name=peertube -q) consider docker-compose rm
  • using with jq to parse output fabien@fabien-CORSAIR-ONE-i160:~$ curl $(docker inspect upbeat_shannon | jq .[0].NetworkSettings.IPAddress -r) : <!DOCTYPE html>
  • moving a container with volume and docker-compose
  • docker network prune to remove unused interfaces that might create conflicts
  • to list all containers, including ones not currently running docker container ls -a
    • useful to restart a container running just temporarily e.g. Nextcloud local instance for pulling large video out of an iPhone
  • change the ports values in docker-compose.yml if docker-compose up fails because of a used port, typically 8080
  • docker stop instance_name: stop the instance
  • docker start instance_name: start the instance
  • docker rm instance_name: delete the instance
  • docker logs instance_name: get console output if the instance
  • docker inspect instance_name: get details of running instance including IP address
  • docker ps: list running instances
  • docker help : the MOST important command ;)

From SundayGeekBrunch2016InventingOnPrinciple3

  • made first own Docker file
  • difference between container and images
    • an image, result of a build from a Dockerfile, is not running
  • exiting container if process in daemon mode
    • depending on the target usage but if passed the -d parameter must make sure to run the target process in foreground
  • docker attach to access the terminal inside a running container
    • if you need a shell instead exec -it containername /bin/bash
      • note that vi/vim might not be present, consider sed instead to edit configuration files
  • docker -p 80:80 for HTTPd port mapping

To explore


Note

My notes on Tools gather what I know or want to know. Consequently they are not and will never be complete references. For this, official manuals and online communities provide much better answers.