title: Docker Swarm error - invalid mount config for type
body: <p>This is my Docker compose/stack file. When I deploy on a single node, everything works fine, but when I deploy on multiple nodes I get the following error:</p>
  
  <blockquote>
    <p>invalid mount config for type bind bind source path does not exist</p>
  </blockquote>
  
  <pre><code>version: '3'
  services:
    shinyproxy:
      build: /etc/shinyproxy
      deploy: 
        replicas: 3
      user: root:root
      hostname: shinyproxy
      image: shinyproxy-example
      restart: unless-stopped
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
      ports:
        - 5000:5000
      networks: 
        - proxynetwork
    mysql:
      image: mysql
      deploy: 
        replicas: 3    
      volumes:
        - /mysqldata:/var/lib/mysql
      environment:
        MYSQL_ROOT_PASSWORD: root_password
        MYSQL_DATABASE: keycloak
        MYSQL_USER: keycloak
        MYSQL_PASSWORD: password
      networks: 
        - proxynetwork
    keycloak:
      deploy: 
        replicas: 3  
      image: jboss/keycloak
      volumes:
        - /etc/letsencrypt/live/ds-gym.de/fullchain.pem:/etc/x509/https/tls.crt
        - /etc/letsencrypt/live/ds-gym.de/privkey.pem:/etc/x509/https/tls.key
        #- /theme/govuk-social-providers/:/opt/jboss/keycloak/themes/govuk-social-providers/
      environment:
        - PROXY_ADDRESS_FORWARDING=true
        - KEYCLOAK_USER=myadmin
        - KEYCLOAK_PASSWORD=mypassword
      ports:
        - 8443:8443
      networks: 
        - proxynetwork
  
  networks:
    proxynetwork:
      external: true
  </code></pre>
  
  <p>I understand that the volumes path is expected on every other node too, but I think this is a very bad practice and my other 2 nodes are anyway just workers. How can I solve that problem? Hopefully there is a solution which allows me to keep the volumes, since I use the same file for <code>docker-compose build</code> to build my images.</p>
  
  <p>Can someone help me?</p>
  
  <p>Thank you :-)</p>