user3751086
user3751086

Reputation: 249

Prevent docker image to overwrite config files (transmission)

I use docker-transmission container with docker-compose to run transmission app. The docker-compose file contains the following simple volume mapping:

    volumes:
  - ./data:/config

The transmission app configuration file is stored in /config/settings.json and is created every time the container restarts. I need to make certain customization into the configuration. If I do it manually, it's overwritten with the default config when the container restarts. What is the proper way to either prevent the config file to be rewritten or to replace the newly created default config file with my custom one? Prbably the latter should be the preferred way... Or mabe there're options 3, 4, 5...

Upvotes: 0

Views: 334

Answers (2)

user3751086
user3751086

Reputation: 249

Well, it appeared to be much simplier... I didn't manage to mention that all this happens on QNAP NAS and container station... Assumed that this doesn't matter... But I was wrong... It appeared that the native behaviour of container station is when I map the volume to the home folder of application, it wipes its content when app is recreated. Once I move the data to a different location on disk, no issues

Upvotes: 0

Tschösi
Tschösi

Reputation: 579

You can try to set the bind mount to read only. This will prevent the container from being able to write to it.

volumes:
  - ./data:/config:ro

Upvotes: 0

Related Questions