dockerdocker-composesentry

How to change Docker config of an already running container?


I have installed Sentry onpremise and after some time tinkering I got it to work and changed the system.url-prefix option to the correct URL using the command line. However there are 2 problems still:

There are 3 config files at play, but not all of them register and that makes it confusing.

  1. sentry.conf.py

Containing

SENTRY_OPTIONS['system.url-prefix'] = 'https://sentry.mydomain.com'
SENTRY_OPTIONS['mail.from'] = 'sentry@mydomain.com'
  1. config.yml

Containing

mail.from: 'sentry@mydomain.com'
system.url-prefix: 'https://sentry.mydomain.com'
  1. docker-compose.yml

enter image description here

Restarting the containers does not load the new config.

Related issue. However I don't know what to do after changing the config like in the comment (SENTRY_OPTIONS['mail.from'])


Solution

  • You need to make your modified config files visible inside the container.

    If they are built into the image (possibly via COPY or ADD in the Dockerfile), then restarting your container does not help, because you're doing it on an old image. You should be rebuilding the image, stopping the old one and starting the new. Rather annoying and error-prone way.

    Better way is to "mount" your files via volumes. Docker volumes can be single files, not only directories. You can add the section volumes in your docker-compose.yml:

    my_container:
      image: my_image
      volumes:
        sentry.conf.py:/full/path/to/sentry.conf.py/in/the/container
        config.yml:/similar/full/path/to/config.yml
      ports:
        ...
      command: ...
    

    There's a chance you already have some volumes defined for this particular container (to hold persistent data for example), then you need to simply add volume mappings for your config files.

    Hope this helps. All the best in the New Year!