dockerdockerfilematomo

Updating matomo customvariables via a dockerfile


I have a dockerfile in which pulls in matomo and makes a copy of my config file,

FROM matomo:3.14.1

COPY config/config.php /var/www/html/config/config.php

RUN ./console customvariables:set-max-custom-variables 10

However I cannot seem to successfully update the custom variables, I can run the docker build without the RUN and see the ./console command within the /var/www/html location, therefore I cant quite understand why it would not then just execute this command also? Im I doing anything wrong here?


Solution

  • That image's Dockerfile declares a VOLUME for the /var/www/html directory so derived images can't ever change the content of that directory. You'll need to use a docker run -v option or Compose volumes: to inject your config file; you can do this without creating a custom image.

    docker run \
      -v $PWD/config/config.php:/var/www/html/config/config.php \
      ... --other-docker-options ... \
      mamoto:3.14.1