Sample Header Ad - 728x90

reading fstab to mount sshfs in container

0 votes
2 answers
2590 views
I'm using Docker to create an image from openjdk:8-jdk-alpine and trying to mount a remote folder using sshfs + fuse. in order to do that I run the container with docker run -d --rm --device /dev/fuse --privileged my_container the code in the Dockerfile I put the following lines: RUN echo "sshfs#myuser@${host}:${folder} $mount_folder fuse allow_other,default_permissions,umask=0007,idmap=file,uidfile=/etc/sshfs_umap,gidfile=/etc/sshfs_gmap,nomap=ignore,StrictHostKeyChecking=no,IdentityFile=/root/.ssh/id_rsa 0 0" >> /etc/fstab this line basically add to /etc/fstab the command to mount remote folder using sshfs. when I access the container, I can't see the files in my mount_folder, but when i manually run $mount -a the folder is successfully mounted. how can I make this automatically mounted when container starts?
Asked by toto (113 rep)
Apr 28, 2020, 07:56 PM
Last activity: Jun 27, 2025, 07:08 PM