Docker error while using IPFS mount

I am trying to build a docker container on my local machine using a Dockerfile stored on a remote host.
Remote machine: added the Dockerfile to ipfs by “ipfs add Dockerfile”
Local machine: using ipfs mount at /ipfs/

While trying to build the Dockerfile, I run into a permission denied error (see below).

$ sudo docker build -t remote_redis_server -f /ipfs/QmYZze6h8psAxJVrXiURtdt8UZZbT3vNLoSR1hQjxMvXcz .
unable to prepare context: unable to evaluate symlinks in Dockerfile path: lstat /ipfs: permission denied

However doing “cat /ipfs/QmYZze6h8psAxJVrXiURtdt8UZZbT3vNLoSR1hQjxMvXcz” has no issues.

Is this possibly an IPFS mount permissions issue?

What user are you running ipfs as? See the part about user_allow_other:


Otherwise, docker may be tripping up due to the fact that /ipfs is a very special directory (it can’t be listed). Try adding the dockerfile with ipfs add -w Dockerfile. That’ll give you a directory containing the dockerfile. Then, you can run:

$ sudo docker build -t remote_redis_server -f /ipfs/HASH/Dockerfile .
1 Like

Thank you. Following the instructions worked. Specifically:
*** Edit /etc/fuse.conf to enable non-root users, i.e.:

/etc/fuse.conf - Configuration file for Filesystem in Userspace (FUSE)

Set the maximum number of FUSE mounts allowed to non-root users.

The default is 1000.

#mount_max = 1000

Allow non-root users to specify the allow_other or allow_root mount options.

user_allow_other

*** Next set Mounts.FuseAllowOther config option to true:

ipfs config --json Mounts.FuseAllowOther true ipfs daemon --mount