Skip to content

Instantly share code, notes, and snippets.

@brian-tex
Last active April 28, 2023 11:56
Show Gist options
  • Select an option

  • Save brian-tex/a54c4933f13401088c474116d560686c to your computer and use it in GitHub Desktop.

Select an option

Save brian-tex/a54c4933f13401088c474116d560686c to your computer and use it in GitHub Desktop.
This is for Swarm
  1. First you'll want to manually create the Docker volumes:

    docker volume create --driver local \
      --opt type=nfs \
      --opt o=addr=nfs_server_ip,rw,nolock,hard,nointr,nfsvers=4 \
      --opt device=:/path/to/nfs/share/on/server \
      nfs_share
    
    docker volume create --driver local \
      --opt type=cifs \
      --opt o=username=samba_user,password=samba_password,vers=3.0,uid=1000,gid=1000,rw \
      --opt device=//samba_server_ip/path/to/samba/share \
      samba_share
    
  2. Then, deploy the stack.

    version: '3.8'
    
    services:
      my_service:
        image: your_image_name:your_image_tag
        deploy:
          replicas: 1
          restart_policy:
            condition: on-failure
        volumes:
          - nfs_share:/path/in/container/for/nfs
          - samba_share:/path/in/container/for/samba
    
    volumes:
      nfs_share:
        external: true
      samba_share:
        external: true
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment