Docker bash autocomplete
curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose
Docker zsh autocomplete
mkdir -p ~/.zsh/completion curl -L https://raw.githubusercontent.com/docker/compose/$(docker-compose version --short)/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
Docker Information
docker info
Docker Version
docker version
Remove docker Images
docker rmi $(docker images | grep "^\" | awk ‘{print $3}’)
docker images -q | xargs docker rmi
docker rmi $(docker ps -q)
Delete all docker containers
docker rm $(docker ps -a -q)
Delete all Docker Images
docker rmi $(docker images -q)
Build Image
docker build -t flexsolutions/pentaho:v1 .
docker build -t flexsolutions/flexdas:v1.0.1 .
Docker Volume
docker volume inspect --format '{{ .Mountpoint }}' repo
Show IP Address
docker inspect --format '{{ .NetworkSettings.IPAddress }}' container docker inspect 'CONTAINERID' | grep -w "IPAddress" | awk '{ print $2 }' | head -n 1 | cut -d "," -f1 docker inspect -f '{{.Name}} - {{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $(docker ps -aq) docker ps -q | xargs docker inspect --format '{{ .Id }} - {{ .Name }} - {{ .NetworkSettings.IPAddress }}'
Swarm: Query
token=$(docker -H 172.17.0.3:2345 swarm join-token -q worker) && echo $token
Swarm: Connect
docker swarm join 172.17.0.3:2377 --token $token
Swarm: Query
> docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
b8eng5t9qnrgzwkzq7jvvxe73 host02 Ready Active
mq30v4fy2qrjwym47lywkdiav * host01 Ready Active Leader
Swarm: Network
> docker network create -d overlay skynet
poxwtz4ovzi27pkkb41s9cuzy
Swarm: Service
> docker service create --name http --network skynet --replicas 2 -p 80:80 katacoda/docker-http-server
> docker service ps http
Show ports Redirec
Commit update
docker commit flexsolutions/flexcrm:1.0
Aliases
alias diclean='docker images | grep '''''' | grep -P '''[1234567890abcdef]{12}''' -o | xargs -L1 docker rmi' alias dclean='docker ps -a | grep -v '''CONTAINER|_config|_data|_run''' | cut -c-12 | xargs docker rm'
Update
> curl -L assets.joinscrapbook.com/docker/dockerd-17-05 -o dockerd
> mv dockerd /usr/bin/dockerd && chmod +x /usr/bin/dockerd
List all containers (only IDs)
docker ps -aq
Stop all running containers
docker stop $(docker ps -aq)
Remove all containers
docker rm $(docker ps -aq)
Remove all images
docker rmi $(docker images -q)