From 0f99a56c9d225514e138cfcc639eb5a0e277aaa2 Mon Sep 17 00:00:00 2001
From: jonastheis <mail@jonastheis.de>
Date: Sat, 28 Mar 2020 11:01:06 +0100
Subject: [PATCH] Fix permission denied in container if run without mounting a
 `rw` volume making it possible to run as throw-away container. Remove
 `VOLUME` from Dockerfile as this only pollutes host system with anonymous
 volumes.

---
 Dockerfile         | 4 +---
 docker-compose.yml | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 62df6521..eb159806 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -34,8 +34,6 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
 # user:group is nonroot:nonroot, uid:gid = 65532:65532
 FROM gcr.io/distroless/static@sha256:23aa732bba4c8618c0d97c26a72a32997363d591807b0d4c31b0bbc8a774bddf
 
-VOLUME /mainnetdb
-
 EXPOSE 14666/tcp
 EXPOSE 14626/udp
 
@@ -44,4 +42,4 @@ COPY --from=build /go/bin/goshimmer /run/goshimmer
 # Copy the default config
 COPY config.default.json /config.json
 
-ENTRYPOINT ["/run/goshimmer", "--config-dir=/", "--database.directory=/mainnetdb"]
+ENTRYPOINT ["/run/goshimmer", "--config-dir=/", "--database.directory=/tmp/mainnetdb"]
diff --git a/docker-compose.yml b/docker-compose.yml
index 42affc44..9b63d434 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -14,7 +14,7 @@ services:
     # make sure to give read/write access to the folder ./mainnetdb (e.g., chmod -R 777 ./mainnetdb)
     # optionally, you can mount a config.json into the container
     volumes:
-      - ./mainnetdb/:/mainnetdb/:rw
+      - ./mainnetdb/:/tmp/mainnetdb/:rw
       #- ./config.json:/config.json:ro
     # Expose ports:
     # gossip:       - "14666:14666/tcp"
-- 
GitLab