BirgerK / docker-apache-letsencrypt

This docker-image contains a simple Apache webserver and supports https-encryption by great Let's Encrypt certificates!
68 stars 47 forks source link

Remove VOLUME directive #11

Closed ericjacolin closed 5 years ago

ericjacolin commented 5 years ago

I needed to bind the container Apache virtual host configuration and the Apache and certbot log file locations from a persistent disk instead of volumes, which is what one typically wants to do on a production environment

services:
    apache-proxy:
        build:
            context: "docker-apache-letsencrypt"
        restart: always
        ports:
            - "80:80"
            - "443:443"
        volumes:
            - "${PDISK_MNT}/etc/letsencrypt:/etc/letsencrypt"
            - "${PDISK_MNT}/etc/apache-proxy/sites-enabled:/etc/apache2/sites-enabled"
            - "${PDISK_MNT}/log/letsencrypt:/var/log/letsencrypt"
            - "${PDISK_MNT}/log/apache-proxy:/var/log/apache2"

Since it is not possible to override a parent VOLUME directive, I could not extend the image but had to clone the Dockerfile and remove the VOLUME directive, which is not ideal. Removing the VOLUME directive would give more flexibility to users.

BirgerK commented 5 years ago

Of course it is possible to mount paths from native host, if those paths were declared as VOLUME.

From documentation (https://docs.docker.com/v17.09/engine/reference/builder/#understand-how-cmd-and-entrypoint-interact) :

The VOLUME instruction creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers.

I'm also using this image with a lot of mounted paths.

Which error messages do you see if you try it?

ericjacolin commented 5 years ago

Thanks I gave it a try and indeed it seems that the VOLUME directive is harmless here. This article helped me better understand why. Closing the issue.

ericjacolin commented 5 years ago

Closed