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