admin:linux:docker:start

This is an old revision of the document!


Docker

/var/lib/docker/volumes Volumes
Automated Nginx Proxy jwilder/nginx-proxy
Automated Nginx Letsencrypt Companion jrcs/letsencrypt-nginx-proxy-companion
Nextcloud nextcloud
TCP Proxy tecnativa/docker-tcp-proxy
UDP Proxy instantlinux/udp-nginx-proxy
PostgreSQL postgres

Start interactive shell in container

docker exec -ti container sh

List stopped containers

docker ps --filter "status=exited"

Get command used to start a Docker container

docker inspect -f '{{json .Config}}' CONTAINERID | jq '.Env'

Get IP of a container

docker inspect --format '{{ .NetworkSettings.IPAddress }}' CONTAINERID
docker system prune -a
 
WARNING! This will remove:
    - all stopped containers
    - all volumes not used by at least one container
    - all images without at least one container associated to them
Are you sure you want to continue? [y/N] y
# delete all volumes not in use or dangling
docker volume rm $(docker volume ls -qf dangling=true)
 
# same
docker system prune --all --volumes --force
docker inspect -f '{{ range .Mounts }}{{ .Source }}:{{ .Destination }} {{ end }}' $(docker-compose ps -q)
  • Bivac - backup container volumes using Restic
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
 
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE

see also: The New Minimalist Operating Systems (blog.docker.com)

  • Rancher
  • Project Atomic
  • CoreOS
  • Snappy Ubuntu Core

to be able to access mounts with enabled SELinux, you need to specify :z or :Z to the bind mount option.

See also: https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

docker exec CONTAINERNAME mysql_upgrade "-uroot" "-pROOTPASSWORD"

setups / howtos

  • Last modified: 2020-07-27 08:51