docker with sshfs mounted directory
来源:互联网 发布:ue4 unity3d 编辑:程序博客网 时间:2024/06/03 21:30
requirement
I want to run a docker image in machine A, and mount a directory DIR_B in Machine B.
try
I mkdir a directory DIR_A in machine A, and used sshfs to mount the dir in machine B:
mkdir -p DIR_A
sshfs DIR_IP:DIR_B DIR_A
then mount the dir in docker container:
docker run -it –rm -v=”DIR_A:DIR_IN_DOCKER” DOCKER_IMAGE /bin/bash
But the docker daemon reported an error and exited.
So I changed DIR_A to it’s parent directory, and run again:
docker run -it –rm -v=”DIR_A:DIR_IN_DOCKER” DOCKER_IMAGE /bin/bash
$ ls
This time, the docker can be started, and “ls” reports another error “permission denied”
So this should be a file permission issue.
solution
Checked sshfs manual, and found out these lines:
FUSE options:
…
-o allow_other
allow access to other users
So this should be caused by the docker container is executed by the docker daemon, and the UID of docker daemon is not the same as the current user.
So use the following command to update fuse config:
echo ‘user_allow_other’ | sudo tee -a /etc/fuse.conf
sudo chmod 644 /etc/fuse.conf
Then mount with:
sshfs -o allow_other,uid=1000,gid=1000 DIR_IP:DIR_B DIR_A
note: uid and gid should be the same as the uid & gid inside the docker container.
Then run docker:
docker run -it –rm -v=”DIR_A:DIR_IN_DOCKER” DOCKER_IMAGE /bin/bash
Success.
- docker with sshfs mounted directory
- sshfs
- sshfs
- sshfs
- sshfs
- Building Komodo with Docker
- Working with Docker Images
- Using Supervisor with Docker
- Using Supervisor with Docker
- install caffe with docker
- spring-boot with docker
- Docker Error with
- Powershell with file and directory
- vue--mounted
- sshfs 挂载
- Centos SSHFS
- Running GUI apps with Docker
- ORA-27054 NFS file system where the file is created or resides is not mounted with correct options
- php第一章笔记
- 总结
- Vijos——P1000 A+B Problem
- FFmpeg+SDL视频播放器(脱离开发环境)学习笔记
- 【20.51%】【codeforces 610D】Vika and Segments
- docker with sshfs mounted directory
- jQuery日记(2)--jQuery效果
- Linux之软连接和硬链接
- jQuery日记(3)--jQueryHTML
- fun(int *a, int n, int *odd, int *even)
- jenkins的安装与使用(基于 centos 7)
- swift init()函数总结
- jQuery日记(4)--jQuery遍历
- Python自学之路---第一天变量类型