3

I have an NFS server at nas.vm.lan == 192.168.122.30. It exports /srv.

I have three Docker hosts set up as a swarm at docker-gitlab-swarm1/2/3 == 192.168.122.27/28/29.

I have four volumes defined in my docker-compose file. Here is one of them; they all look like this with just some names and paths changed:

Volumes:
    gitlab-config:
        driver_opts:
            type:   "nfs"
            o:      "addr=192.168.122.30,nolock,soft,rw"
            device: ":/srv/gitlab/config"

The three services that make up Gitlab (PostgreSQL, Redis, Gitlab itself) are set to be deployed as a stack. Redis is not expected to persist any data, but PostgreSQL and Gitlab are, and the services make the appropriate references to the four named volumes.

The Redis container starts without complaint.

Since the Gitlab container depends on PostgreSQL, PostgreSQL attempts to start before it. This is the output from docker stack ps gitlab --no-trunc:

ID                          NAME                  IMAGE                                                                                                 NODE                          DESIRED STATE       CURRENT STATE                     ERROR                                                                                                                                              PORTS
vnbbmybelrsh623nkl1mc9z18   gitlab_postgresql.1   postgres:9.6.2-alpine@sha256:f88000211e3c682e7419ac6e6cbd3a7a4980b483ac416a3b5d5ee81d4f831cc9         docker-gitlab-swarm1.lan      Ready               Rejected less than a second ago   "error while mounting volume with options: type='nfs' device=':/srv/postgresql/gitlab' o='addr=192.168.122.30,nolock,soft,rw': no route to host"   

(and many more of the same)

I can mount the filesystem from the NFS server to any of the Docker hosts.

How do I cause there to become a route to the NFS server such that the volume declarations work?

Glenn Lasher
  • 81
  • 1
  • 7

1 Answers1

0

I think this will work when setting the type to nfs4.

Volumes:
    gitlab-config:
        driver_opts:
            type:   "nfs4"
            o:      "addr=192.168.122.30,nolock,soft,rw"
            device: ":/srv/gitlab/config"
arjen
  • 1