2014-07-26 7 views
5

मैं डॉकर कंटेनर के अंदर s3fs को माउंट करना चाहता हूं।क्या s3fs डॉकर कंटेनर के अंदर माउंट करने में सक्षम नहीं है?

मैं 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 

दिखा "कार्रवाई की अनुमति नहीं है" त्रुटि।

तो मैं googled, और इस तरह से किया था (जोड़ने --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 कमांड चलाएँ, त्रुटि "परिवहन endpoint जुड़ा हुआ नहीं है" हुआ

मैं डॉकर कंटेनर के अंदर 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 

उत्तर

6

मुझे यकीन है कि आप उससे बात नहीं बनी थी क्या नहीं कर रहा हूँ, लेकिन मैं इस प्राप्त करने में सक्षम था

Dockerfile: इस तरह काम करने के लिए

FROM ubuntu:12.04 

RUN apt-get update -qq 
RUN apt-get install -y build-essential libfuse-dev fuse-utils libcurl4-openssl-dev libxml2-dev mime-support automake libtool wget tar 

RUN wget https://github.com/s3fs-fuse/s3fs-fuse/archive/v1.77.tar.gz -O /usr/src/v1.77.tar.gz 
RUN tar xvz -C /usr/src -f /usr/src/v1.77.tar.gz 
RUN cd /usr/src/s3fs-fuse-1.77 && ./autogen.sh && ./configure --prefix=/usr && make && make install 

RUN mkdir /s3bucket 

के साथ निर्माण के बाद:

docker run -it -e AWSACCESSKEYID=obscured -e AWSSECRETACCESSKEY=obscured --privileged ubuntu/s3fs:latest bash 

और फिर कंटेनर के अंदर:

docker build --rm -t ubuntu/s3fs:latest . 

मैं के साथ कंटेनर भाग गया

[email protected]:/# s3fs s3bucket /s3bucket 
[email protected]:/# ls /s3bucket 
testing.this.out work.please working 
[email protected]:/# 

जो सफलतापूर्वक मेरी s3bucket में फ़ाइलों को सूचीबद्ध किया है।

आपको यह सुनिश्चित करने की ज़रूरत है कि आपके मेजबान मशीन पर कर्नेल फ्यूज का समर्थन करता है, लेकिन ऐसा लगता है कि आप पहले से ही ऐसा कर चुके हैं?

नोट: आपके एस 3 माउंटपॉइंट डॉकर के - वॉल्यूम या - वॉल्यूम-निर्देशों का उपयोग करते समय अन्य कंटेनरों के अंदर से नहीं दिखाएगा/काम नहीं करेगा। उदाहरण के लिए:

docker run -t --detach --name testmount -v /s3bucket -e AWSACCESSKEYID=obscured -e AWSSECRETACCESSKEY=obscured --privileged --entrypoint /usr/bin/s3fs ubuntu/s3fs:latest -f s3bucket /s3bucket 
docker run -it --volumes-from testmount --entrypoint /bin/ls ubuntu:12.04 -ahl /s3bucket 
total 8.0K 
drwxr-xr-x 2 root root 4.0K Aug 21 21:32 . 
drwxr-xr-x 51 root root 4.0K Aug 21 21:33 .. 

बाल्टी में फ़ाइलों के बावजूद कोई फाइल नहीं लौटाता है।

+1

धन्यवाद! मैं आपकी प्रक्रिया का परीक्षण करता हूं, यह आकर्षण की तरह काम करता है। लेकिन जैसा कि आप कहते हैं, यह अन्य कंटेनर से माउंट नहीं कर सकता ... क्या अन्य कंटेनर से इसका उपयोग करने का कोई तरीका है? – kochizufan

+5

'- वंचित 'यह क्या है, दुर्भाग्यवश यह केवल रन चरण के दौरान काम करता है, न कि निर्माण चरण। – buley

संबंधित मुद्दे