5
我想在docker容器内部安装s3fs。s3fs无法在Docker容器中装入?
我做搬运工图像与s3fs,也确实是这样的:
host$ docker run -it --rm docker/s3fs bash
[ [email protected]:~ ]$ s3fs s3bucket /mnt/s3bucket -o allow_other -o allow_other,default_acl=public-read -ouse_cache=/tmp
fuse: failed to open /dev/fuse: Operation not permitted
显示 “不允许操作” 错误。
所以我一派,并没有这样的(添加--privileged = TRUE)再次:
host$ docker run -it --rm --privileged=true docker/s3fs bash
[ [email protected]:~ ]$ s3fs s3bucket /mnt/s3bucket -o allow_other -o allow_other,default_acl=public-read -ouse_cache=/tmp
[ [email protected]:~ ]$ ls /mnt/s3bucket
ls: cannot access /mnt/s3bucket: Transport endpoint is not connected
[ [email protected]:~ ]$ fusermount -u /mnt/s3bucket
[ [email protected]:~ ]$ s3fs s3bucket /mnt/s3bucket -o allow_other -o allow_other,default_acl=public-read -ouse_cache=/tmp
[ [email protected]:~ ]$ ls /mnt/s3bucket
ls: cannot access /mnt/s3bucket: Transport endpoint is not connected
然后,安装不显示错误,但如果运行ls命令,“交通运输端点没有连接”的错误发生。
如何在docker容器中装载s3fs? 这不可能吗?
[已更新]
添加Dockerfile配置。
Dockerfile:
FROM dockerfile/ubuntu
RUN apt-get update
RUN apt-get install -y build-essential
RUN apt-get install -y libfuse-dev
RUN apt-get install -y fuse
RUN apt-get install -y libcurl4-openssl-dev
RUN apt-get install -y libxml2-dev
RUN apt-get install -y mime-support
RUN \
cd /usr/src && \
wget http://s3fs.googlecode.com/files/s3fs-1.74.tar.gz && \
tar xvzf s3fs-1.74.tar.gz && \
cd s3fs-1.74/ && \
./configure --prefix=/usr && \
make && make install
ADD passwd/passwd-s3fs /etc/passwd-s3fs
ADD rules.d/99-fuse.rules /etc/udev/rules.d/99-fuse.rules
RUN chmod 640 /etc/passwd-s3fs
RUN mkdir /mnt/s3bucket
rules.d/99-fuse.rules:
KERNEL==fuse, MODE=0777
谢谢!我测试你的程序,它的工作就像魅力。 但是,正如你所说,它不能从其他容器安装... 有没有什么方法可以使用它从其他容器? – kochizufan
'--privileged'是什么,不幸的是,这只能在运行阶段而不是在构建阶段工作。 – buley