user1161064
user1161064

Reputation: 65

s3 mounted inside the container. how to expose it to the host?

I have been playing around with possibility of having a container that mounts an s3 bucket and exposes it to the outside.

I used https://github.com/FindHotel/aws-s3-mount to have the s3 bucket mounted inside the container successfully. The mount is using FUSE.

I couldn't find a way to reach to that s3 mount from the host. Is it possible? Any other ideas to achieve the same goal?

Thanks!

Upvotes: 3

Views: 3654

Answers (1)

odk
odk

Reputation: 2252

I do similar thing with glusterFS it requires higher permissions for the container but it's doable. In short docker command would be:

docker run --cap-add SYS_ADMIN --device fuse -v host_mount_dir:container_mount_dir:shared IMAGE COMMAND

If you get error like "Path /foo is mounted on /foo but it is not a shared mount ..." then your docker daemon runs in different mount namespace than systemd. There is an easy way to make it in same namespace:

mkdir -p /etc/systemd/system/docker.service.d/
cat <<EOF > /etc/systemd/system/docker.service.d/clear_mount_propagation_flags.conf
[Service]
MountFlags=shared
EOF

And restart docker daemon. TL;DR: mount will be visible on host if you mount it into dir binded by -v. Watch out for dragons ;)

Upvotes: 10

Related Questions