Docker-swarm: Unterschied zwischen den Versionen

Aus xinux wiki
Wechseln zu: Navigation, Suche
(docker stack)
(docker stack)
 
(2 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 41: Zeile 41:
 
         - traefik.enable=true
 
         - traefik.enable=true
 
         - traefik.port=80
 
         - traefik.port=80
         #- traefik.frontend.rule=Host:whoami.bonis.info
+
         #- traefik.frontend.rule=Host:whoami.bis.info
         #- traefik.frontend.rule=Host:whoami.dsgvo-europa.com
+
         #- traefik.frontend.rule=Host:whoami.d-1ropa.com
         - traefik.frontend.rule=Host:whoami.2meet.de
+
         - traefik.frontend.rule=Host:whoami.98mti.de
 
         - traefik.frontend.passHostHeader=true
 
         - traefik.frontend.passHostHeader=true
         #- traefik.frontend.rule=Host:whoami.cloudraiser.net
+
         #- traefik.frontend.rule=Host:whoami.clriser.net
 
         - traefik.protocol=http
 
         - traefik.protocol=http
 
</pre>
 
</pre>
Zeile 57: Zeile 57:
  
 
=links=
 
=links=
 +
*https://linuxconfig.org/how-to-configure-docker-swarm-with-multiple-docker-nodes-on-ubuntu-18-04
 
*https://clouding.io/kb/en-us/articles/360010288160-Docker-Swarm-on-Ubuntu-18-04
 
*https://clouding.io/kb/en-us/articles/360010288160-Docker-Swarm-on-Ubuntu-18-04
 +
*https://geek-cookbook.funkypenguin.co.nz/recipes/nextcloud/

Aktuelle Version vom 25. März 2020, 17:04 Uhr

install

change host file

/etc/hosts
10.50.66.21 node01
10.50.66.22 node02 
10.50.66.23 node03

create swarm

node01

swarm init

  • docker swarm init --advertise-addr 10.50.66.21
node02
  • docker swarm join --token XXXXXXXXXX
  • docker swarm promote node0
node03
  • docker swarm join --token XXXXXXXXXX

docker stack

  • vi docker-compose.yml
version: "3.5"
services:
  web:
    image: containous/whoami
    ports:
      - "80:80"
    #    networks:
    #      - ext
    deploy:
      mode: replicated # replicate container on other swarm nodes
      replicas: 3 #number of replicas
      labels:
        - traefik.enable=true
        - traefik.port=80
        #- traefik.frontend.rule=Host:whoami.bis.info
        #- traefik.frontend.rule=Host:whoami.d-1ropa.com
        - traefik.frontend.rule=Host:whoami.98mti.de
        - traefik.frontend.passHostHeader=true
        #- traefik.frontend.rule=Host:whoami.clriser.net
        - traefik.protocol=http
  • docker stack deploy -c docker-stack.yml $(basename $PWD)
  • docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
wz126t6z1puo        whoami_web          replicated          3/3                 containous/whoami:latest   *:80->80/tcp

links