Docker-swarm: Unterschied zwischen den Versionen

Aus xinux wiki
Wechseln zu: Navigation, Suche
(node01 node02 node03)
(node01 node02 node03)
Zeile 24: Zeile 24:
 
*docker swarm join --token XXXXXXXXXX
 
*docker swarm join --token XXXXXXXXXX
  
==node01 node02 node03==
+
==docker stack==
*apt install nfs-common nfs-util
+
*vi docker-compose.yaml
*nfs mount
+
<pre>
 +
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.bonis.info
 +
        #- traefik.frontend.rule=Host:whoami.dsgvo-europa.com
 +
        - traefik.frontend.rule=Host:whoami.2meet.de
 +
        - traefik.frontend.passHostHeader=true
 +
        #- traefik.frontend.rule=Host:whoami.cloudraiser.net
 +
        - traefik.protocol=http
 +
</pre>
 +
 
 +
*docker service ls
 +
<pre>
 +
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
 +
wz126t6z1puo        whoami_web          replicated          3/3                containous/whoami:latest  *:80->80/tcp
 +
</pre>
  
 
=links=
 
=links=
 
*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

Version vom 25. März 2020, 16:42 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.yaml
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.bonis.info
        #- traefik.frontend.rule=Host:whoami.dsgvo-europa.com
        - traefik.frontend.rule=Host:whoami.2meet.de
        - traefik.frontend.passHostHeader=true
        #- traefik.frontend.rule=Host:whoami.cloudraiser.net
        - traefik.protocol=http
  • docker service ls
ID                  NAME                MODE                REPLICAS            IMAGE                      PORTS
wz126t6z1puo        whoami_web          replicated          3/3                 containous/whoami:latest   *:80->80/tcp

links