The Hotel Hero

Notes by a Sysadmin


Cluster | Philosophy | Stack

Docker Swarm Commands

April 5, 2021 | Cluster

Follow instructions on Docker for setting up Swarm and Portainer (easy)...

In Docker Swarm containers run in "services". Create a service:

docker service create --name redis --replicas=5 redis:3.0.6

Docker "ls" to list services:

docker service ls

Use secrets:

docker service create --name redis --secret secret.json redis:3.0.6

list all nodes:

docker node ls

get info fo master node:

docker info

From docker-compose file:

docker stack deploy --compose-file docker-compose.yml stackdemo

Portainer (unable to connect to the docker environment)

Update the agents should work:

docker service update portainer_agent --force

Networks

list networks:

docker network ls

create overlay network:

docker network create -d overlay nginx-net

Remove a network:

docker network rm nginx-net


About

I'm a Sysadmin, network manager and cyber security entusiast. The main purpose of this public "notebook" is for referencing repetitive tasks, but it might as well come in handy to others. Windows can not be supported! But all other OS compliant with the POSIX-standard can (with minor adjustments) apply the configs on the site. It is Mac OSX, RHEL and all the Fedora based distros and Debian based (several 100's of OS's), all the BSD distros, Solaris, AIX and HP-UX.

Links