znc / znc-docker

https://hub.docker.com/_/znc/
49 stars 29 forks source link

Disable volume /znc-data #4

Closed luckydonald closed 7 years ago

luckydonald commented 7 years ago

Hey, I'm trying to disable the VOLUME /znc-data.

Use case is that I wan't to extend with FROM znc and add my config with ADD commands.

FROM znc:1.6.5

COPY ./modules /znc-data/modules
COPY ./znc.conf /znc-data/znc.conf

The image is deployed remotely, so I want to include all modules (/znc-data/modules) and config files with the built image. How I understand, volumes will inherit data on the first build. On later builds they will ignore added/changed files. Also it will discard any files added to the folder after the VOLUME keyword (in slim/Dockerfile:50).

DarthGandalf commented 7 years ago

Can you mount the volume remotely?

If you want the volume to not be used, I think you can pass another --datadir... It's now configured at https://github.com/znc/znc-docker/blob/master/slim/docker-entrypoint.sh#L10 so probably you'll need to change that script to read some other file first, then default that variable to /znc-data if not set. It has similar code for /znc-build-modules.sh already. Well, or just replace ENTRYPOINT entirely, but note that it may change in future versions.

DarthGandalf commented 7 years ago

https://docs.docker.com/engine/tutorials/dockervolumes/#mount-a-shared-storage-volume-as-a-data-volume

luckydonald commented 7 years ago

With either approach, I have to replace whole files, which makes it sorta redundant to extend from this one.

Mentioning the DATADIR="/znc-data" in the entrypoint.sh file, could we change it to accept arguments or environmental variables?

DATADIR={DATADIR:-/znc-data}

This would use an already defined $DATADIR or default to/znc-data if not set. We could also use args via $1.

DarthGandalf commented 7 years ago

Should be fixed now.