docker plugin install --grant-all-permissions vieux/sshfs docker volume create -d vieux/sshfs -o sshcmd=usfo@192.168.1.1:/swarm-study/web/data -o password='123' sshvolume
FROM debian COPY sources.list /etc/apt/sources.list RUN apt-get update RUN apt-get install -y apache2 RUN apt-get install -y php7.0 php7.0-mysql COPY apache2.conf /etc/apache2/apache2.conf RUN groupadd -g 1000 usfo RUN useradd -u 1000 -g 1000 usfo COPY index.php /var/www/html/index.php RUN mkdir /autorun COPY autorun.sh /autorun/autorun.sh RUN chmod 755 /autorun/autorun.sh RUN mkdir /html-data CMD ./autorun/autorun.sh
User usfo Group usfo
docker run -itd -p 80:80 --mount type=volume,source=sshvolume,destination=/swarm-data debian2
root@e3ca660f3a8d:/# su root root@e3ca660f3a8d:/# ls -l /swarm-data total 8 -rw-r--r-- 1 usfo usfo 1136 Dec 26 02:37 Desktop.rar -rw-r--r-- 1 usfo usfo 7 Dec 26 02:18 a.txt root@e3ca660f3a8d:/# ls -l / | grep swarm-data drwxr-x--- 1 usfo usfo 4096 Dec 26 02:37 swarm-data
root@e3ca660f3a8d:/# su usfo $ ls -l / |grep swarm-data ls: cannot access '/swarm-data': Permission denied d????????? ? ? ? ? ? swarm-data
docker run -itd -p 80:80 -v /swarm-study/web/data:/swarm-data debian2 root@d678cdb273c8:/# su usfo $ ls -l / | grep swarm-data drwxr-x--- 2 usfo usfo 4096 Dec 26 10:54 swarm-data
docker版本:17.09.1-ce
debian 9
答案 0 :(得分:0)
报价:https://github.com/vieux/docker-volume-sshfs/issues/17
感谢@koenlek
事实证明,您需要使用sshfs的-o allow_other
选项。
docker volume create -d vieux/sshfs -o sshcmd=usfo@192.168.1.1:/swarm-study/web/data -o allow_other -o password='123' sshvolume root@f5132a8f4b84:/# su usfo $ ls -l / | grep swarm-data drwxr-x--- 1 usfo usfo 4096 Dec 26 10:54 swarm-data