I'm trying to create an NFS docker volume, however I'm unable to do so by hostname.
I'm creating the volume with:
sudo docker volume create --name foo_bar --driver local \
--opt type=nfs4 \
--opt o=addr=foo.lan.domain.xyz,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14 \
--opt device=:/volume1/bar
However, when I try to create a docker container which uses this volume, I see:
docker: Error response from daemon: failed to mount local volume: mount :/volume1/bar:/var/lib/docker/volumes/foo_bar/_data, flags: 0x400, data: addr=foo.lan.domain.xyz,rsize=8192,wsize=8192,tcp,timeo=14: invalid argument.
The syslog shows:
kernel: [ 1662.349322] NFS: bad IP address specified: addr=foo.lan.domain.xyz
It seems that NFS is not attempting to resolve the domain name before connecting. This domain name is certainly valid.
$ host foo.lan.domain.xyz
foo.lan.domain.xyz has address 10.0.0.3
$ nslookup foo.lan.domain.xyz
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: foo.lan.domain.xyz
Address: 10.0.0.3
$ showmount -e foo.lan.domain.xyz
Export list for foo.lan.domain.xyz:
/volume1/qux lore.lan.domain.xyz
$ getent hosts 10.0.0.3
10.0.0.3 Bar.lan.domain.xyz
How can I get NFS to resolve this hostname? I'd really rather not hard code the IP address if it can be helped.