Skip to content

Remove explicit VOLUME creation in dockerfile #405

@DavorJ

Description

@DavorJ

Current dockerfile contains:

docker/apache/Dockerfile

Lines 96 to 98 in adb618a

# WORKDIR is /var/www/html (inherited via "FROM php")
# "/entrypoint.sh" will populate it at container startup from /usr/src/matomo
VOLUME /var/www/html

On docker run this creates anonymous volumes that are not clearly visible.

What is problematic is that the entrypoint script checks whether anything is already on that hidden volume:

if [ ! -e matomo.php ]; then

And if not, then extracts the sourcecode:

tar cf - --one-file-system -C /usr/src/matomo . | tar xf -

Besides the fact that this extraction is additive (i.e. not a sync) and can leave old files lingering there, the even more problematic issue is that if one upgrades the Matomo image version in the deployment dockerfile the new container may or may not (depending on how it is run) reuse the hidden volume and not update Matomo. Hence you may expect to see Matomo v5 based on the new image, but you see your old v4 still at runtime.

If someone wants to use a volume, this should be specified in docker run or in the compose file like here:

- matomo:/var/www/html:z

Hence I believe VOLUME should be a runtime option, not a hidden side-effect of the baseline image.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions