docker-volume-netshare icon indicating copy to clipboard operation
docker-volume-netshare copied to clipboard

EFS Mount command missing the actual IP

Open hgontijo opened this issue 7 years ago • 2 comments

When I try to use docker-volume-netshare to mount an EFS volume on a Docker container, the mount command issued does not refer to the respective EFS IP. I cannot use EFS via DNS since our VPC setup does not support Amazon DNS server yet.

docker-volume-netshare start:

$ docker-volume-netshare efs --verbose --noresolve
INFO[0000] == docker-volume-netshare :: Version:  - Built:  ==
INFO[0000] Starting EFS :: availability-zone: , resolve: true, ns:
DEBU[0002] Host path for 10.60.1.46 (10.60.1.46) is at /var/lib/docker-volumes/netshare/efs/10.60.1.46
INFO[0002] Mounting EFS volume : on /var/lib/docker-volumes/netshare/efs/10.60.1.46
DEBU[0002] exec: mount -t nfs4 -o nfsvers=4.1 : /var/lib/docker-volumes/netshare/efs/10.60.1.46

Docker run:

$ docker run -it --rm --volume-driver=efs -v 10.60.1.46:/mount busybox /bin/sh
\docker: Error response from daemon: VolumeDriver.Mount: exit status 32.

I hard-coded the source IP at netshare/drivers/efs.go just to give a try and it worked fine:

func (e efsDriver) mountVolume(source, dest string) error {
	cmd := fmt.Sprintf("mount -t nfs4 -o nfsvers=4.1 %s %s", "10.60.1.46", dest)
	log.Debugf("exec: %s\n", cmd)
	return run(cmd)
}

Version: commit 4bfe7ba0572ee9d135dd59924548a37b1ab2af66

hgontijo avatar Feb 15 '17 00:02 hgontijo

The issue is in fixSource. It always tries to break down the name into an EFS volume name even when --noresolve is set and an IP is provided.

pschwartz avatar Mar 19 '19 15:03 pschwartz

I have found the fix to be as simple as adding this to the start of fixSource:

func (e efsDriver) mountVolume(name, id string) string {
    if !e.resolve {
        return name + ":/"
    }

...
}

pschwartz avatar Mar 19 '19 15:03 pschwartz