Docker Swarm Cheatsheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Init Swarm | |
$ docker swarm init --advertise-addr <IP address of instance> | |
# List machines | |
$ docker-machine ls | |
# Target Local Docker | |
$ eval $(docker-machine env -u) | |
# Target Remote Docker | |
$ eval $(docker-machine env remote-docker) | |
# Ssh to Docker instance | |
$ docker-machine ssh local-vm-1 | |
# Build App | |
$ docker build -f production.Dockerfile -t myapp . | |
# Push image to Docker hub | |
$ docker push myapp | |
# Deploy stack | |
$ docker stack deploy -c docker-stack.yml --with-registry-auth myapp | |
# Update service | |
$ docker service update --image myapp_image myapp_stack | |
# List services | |
$ docker stack services myapp | |
$ docker service ls | |
# Logs | |
$ docker service logs -f myapp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment