PrivateBin / docker-nginx-fpm-alpine

PrivateBin docker image based on Nginx, php-fpm & Alpine Linux stack
https://hub.docker.com/r/privatebin/nginx-fpm-alpine/
151 stars 57 forks source link

docker image creates volume #182

Closed dst78 closed 9 months ago

dst78 commented 9 months ago

I'm using privatebin on an arm64 machine. The image creates three anonymous volumes, despite having mapped the the data directory.

A minimum docker-compose.yaml to reproduce the issue is below.

version: '3.3'
services:
  pastebin:
    user: 1000:1000
    image: privatebin/nginx-fpm-alpine:stable
    volumes:
      - ./privatebin/data:/srv/data

Additionally mapping the config file doesn't change anything.

A "log" of the shell commands used to reproduce:

dst78@localhost privatebin % cat docker-compose.yml
version: '3.3'
services:
  pastebin:
    user: 1000:1000
    image: privatebin/nginx-fpm-alpine:stable
    volumes:
      - ./privatebin/data:/srv/data

dst78@localhost privatebin % docker volume ls
DRIVER    VOLUME NAME

dst78@localhost privatebin % docker compose up -d
[+] Running 6/6
 ✔ pastebin 5 layers [⣿⣿⣿⣿⣿]      0B/0B      Pulled                                     12.0s
   ✔ c30352492317 Pull complete                                                          0.8s
   ✔ 446e43b30727 Pull complete                                                          0.6s
   ✔ fb2854b2a9c1 Pull complete                                                          2.3s
   ✔ c3775ddb3851 Pull complete                                                          1.1s
   ✔ 4f4fb700ef54 Pull complete                                                          1.3s
[+] Building 0.0s (0/0)                                                        docker:default
[+] Running 2/2
 ✔ Network privatebin_default       Created                                              0.7s
 ✔ Container privatebin-pastebin-1  Started                                              0.6s

dst78@localhostprivatebin % docker ps
CONTAINER ID   IMAGE                                COMMAND                  CREATED         STATUS         PORTS      NAMES
c546d3b8fe68   privatebin/nginx-fpm-alpine:stable   "/etc/init.d/rc.local"   8 seconds ago   Up 7 seconds   8080/tcp   privatebin-pastebin-1

dst78@localhost privatebin % docker volume ls
DRIVER    VOLUME NAME
local     99316abb8bc5efc282ce260e31411bb2214e45ca7f49dedb6f508f52a366f748
local     405743ecb340069be20056ab587221addf2a48effefa200e4d23352f6e50211e
local     b324d4267f950061f0bb59a9d9cb372bca78f54a3123ceb08c78ddd414e68751
elrido commented 9 months ago

I assume those are the other 3 directories we mark as volumes in the image: https://github.com/PrivateBin/docker-nginx-fpm-alpine/blob/65ceef01304606a989dbae98d1a4d43bb1d65d0f/Dockerfile#L101-L102

You can attach tmpfs for /run and /tmp, but /var/lib/nginx/tmp should be disk backed, as it can contain larger artifacts, for example large POST requests before they are proxied to php-fpm. See also the volume mediums used in the kubernetes sample: https://github.com/PrivateBin/docker-nginx-fpm-alpine/tree/master#kubernetes-deployment

dst78 commented 9 months ago

Apologies, you're right. This solves that