Docker Registries & Repositories
docker login
docker login localhost:8080
docker logout
docker logout localhost:8080
docker search nginx
docker search nginx --stars=3 --no-trunc busybox
docker pull nginx
docker pull eon01/nginx localhost:5000/myadmin/nginx
docker push eon01/nginx
docker push eon01/nginx localhost:5000/myadmin/nginx
docker create -t -i eon01/infinite --name infinite
docker run -it --name infinite -d eon01/infinite
docker rename infinite infinity
docker rm infinite
docker update --cpu-shares 512 -m 300M infinite
Starting & Stopping Containers
docker start nginx
docker stop nginx
docker restart nginx
docker pause nginx
docker unpause nginx
docker wait nginx
docker kill nginx
Connecting to an Existing Container
docker attach nginx
Getting Information about Containers
docker ps
docker ps -a
docker logs infinite
docker inspect infinite
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -q)
docker events infinite
docker port infinite
docker top infinite
docker stats infinite
Inspecting Changes to Files or Directories on a Container’s Filesystem
docker diff infinite
docker images
docker build .
docker build github.com/creack/docker-firefox
docker build - < Dockerfile
docker build - < context.tar.gz
docker build -t eon/infinite .
docker build -f myOtherDockerfile .
curl example.com/remote/Dockerfile | docker build -f - .
docker rmi nginx
Loading a Tarred Repository from a File or the Standard Input Stream
docker load < ubuntu.tar.gz
docker load --input ubuntu.tar
Save an Image to a Tar Archive
docker save busybox > ubuntu.tar
Showing the History of an Image
docker history
Creating an Image Fron a Container
docker commit nginx
docker tag nginx eon01/nginx
docker push eon01/nginx
docker network create -d overlay MyOverlayNetwork
docker network create -d bridge MyBridgeNetwork
docker network create -d overlay \
--subnet=192.168.0.0/16 \
--subnet=192.170.0.0/16 \
--gateway=192.168.0.100 \
--gateway=192.170.0.100 \
--ip-range=192.168.1.0/24 \
--aux-address="my-router=192.168.1.5" --aux-address="my-switch=192.168.1.6" \
--aux-address="my-printer=192.170.1.5" --aux-address="my-nas=192.170.1.6" \
MyOverlayNetwork
docker network rm MyOverlayNetwork
docker network ls
Getting Information About a Network
docker network inspect MyOverlayNetwork
Connecting a Running Container to a Network
docker network connect MyOverlayNetwork nginx
Connecting a Container to a Network When it Starts
docker run -it -d --network=MyOverlayNetwork nginx
Disconnecting a Container from a Network
docker network disconnect MyOverlayNetwork nginx
Removing a Running Container
docker rm nginx
Removing a Container and its Volume
docker rm -v nginx
Removing all Exited Containers
docker rm $(docker ps -a -f status=exited -q)
Removing All Stopped Containers
docker rm `docker ps -a -q`
docker rmi nginx
docker rmi $(docker images -f dangling=true -q)
docker rmi $(docker images -a -q)
Stopping & Removing all Containers
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q)
Removing Dangling Volumes
docker volume rm $(docker volume ls -f dangling=true -q)
curl -ssl https://get.docker.com | bash
Initializing the Swarm
docker swarm init --advertise-addr 192.168.10.1
Getting a Worker to Join the Swarm
docker swarm join-token worker
Getting a Manager to Join the Swarm
docker swarm join-token manager
docker service ls
docker node ls
docker service create --name vote -p 8080:80 instavote/vote
docker service ps
docker service scale vote=3
docker service update --image instavote/vote:movies vote
docker service update --force --update-parallelism 1 --update-delay 30s nginx
docker service update --update-parallelism 5--update-delay 2s --image instavote/vote:indent vote
docker service update --limit-cpu 2 nginx
docker service update --replicas=5 nginx