fix(Dockerfile): Allow ipfs mount in Docker container
fixes #4329 License: MIT Signed-off-by: hannahhoward <hannah@hannahhoward.net>
hannahhoward committed
Oct 3, 2018 at 17:15 UTC
d0ed1382463b2d8b71c53f2247849f8bed4151e7
1 file changed
+11
Dockerfile
+11
@@ -33,6 +33,9 @@ RUN set -x \
33
# Get the TLS CA certificates, they're not provided by busybox.
34
RUN apt-get update && apt-get install -y ca-certificates
35
36
+# Install FUSE
37
+RUN apt-get update && apt-get install -y fuse
38
+
39
# Now comes the actual target image, which aims to be as small as possible.
40
FROM busybox:1-glibc
41
MAINTAINER Lars Gierth <lgierth@ipfs.io>
@@ -43,8 +46,12 @@ COPY --from=0 $SRC_DIR/cmd/ipfs/ipfs /usr/local/bin/ipfs
46
COPY --from=0 $SRC_DIR/bin/container_daemon /usr/local/bin/start_ipfs
47
COPY --from=0 /tmp/su-exec/su-exec /sbin/su-exec
48
COPY --from=0 /tmp/tini /sbin/tini
49
+COPY --from=0 /bin/fusermount /usr/local/bin/fusermount
50
COPY --from=0 /etc/ssl/certs /etc/ssl/certs
51
52
+# Add suid bit on fusermount so it will run properly
53
+RUN chmod 4755 /usr/local/bin/fusermount
54
+
55
# This shared lib (part of glibc) doesn't seem to be included with busybox.
56
COPY --from=0 /lib/x86_64-linux-gnu/libdl-2.24.so /lib/libdl.so.2
57
@@ -63,6 +70,10 @@ RUN mkdir -p $IPFS_PATH \
70
&& adduser -D -h $IPFS_PATH -u 1000 -G users ipfs \
71
&& chown ipfs:users $IPFS_PATH
72
73
+# Create mount points for `ipfs mount` command
74
+RUN mkdir /ipfs /ipns \
75
+ && chown ipfs:users /ipfs /ipns
76
+
77
# Expose the fs-repo as a volume.
78
# start_ipfs initializes an fs-repo if none is mounted.
79
# Important this happens after the USER directive so permission are correct.