Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.12.3 available

The official documentation can be found on https://wiki.ocsinventory-ng.org. Read it before asking your question.

Profiles folder overwritten everytime in docker

Hello,

I'm using docker with v2.12.3, everything is working fine except the profiles folder (where the profiles permissions are stored).

I have the following volume mounted with docker compose :

 - /var/docker/ocs/profilesconfdata/_data:/usr/share/ocsinventory-reports/ocsreports/config/profiles

When I edit the permissions, the files in /var/docker/ocs/profilesconfdata/_data are updated, so far so good. But when I stop and start the container, everything is overwritten with the files from the ocs image. It's not persistent. I don't have this kind of problem with the database files for example.

How can I prevent the ocs server from overwritting the files on startup ? It should just read them, but be able to update them if necessary.
in OCS Inventory NG server for Unix by (500 points)

6 Answers

–1 vote

A practical workaround is to initialize the configuration once and then reuse it:

  • Start the container without the volume mount.

  • Copy the config directory from the container to the host:

    docker cp <container>:/usr/share/ocsinventory-reports/ocsreports/config /var/docker/ocs/config/geometry dash
  • Stop and remove the container.

  • Mount that directory in docker-compose:

    volumes:
    - /var/docker/ocs/config:/usr/share/ocsinventory-reports/ocsreports/config
by (140 points)
–1 vote
This way the container will use the existing configuration instead of replacing the files each time it starts.
by (140 points)
0 votes

@

Mounting the whole config folder doesn't change anything. And mounting it as ready only will prevent config changes from the gui.

by (500 points)
0 votes
Oh I just noticed your answer was completely unhelpful because you created an account just to post chatgpt's trash. Don't post on the internet if your brain has been eaten by an AI.
by (500 points)
0 votes

The behavior you describe usually happens when the container treats that directory as part of its initial setup rather than a persistent config path. Even with a bind mount, if the startup script copies files into that directory, your changes will be lost. There are similar reports in Docker communities about volumes being overwritten by entrypoint scripts
https://docs.docker.com/storage/volumes/drift boss
One approach could be to move the config outside of the managed path or modify the container startup process. Have you tried inspecting the Dockerfile or entrypoint script to see exactly what happens on container start?

ago by (140 points)
0 votes
I've created custom profiles, that way, they don't get overwritten on restart.
ago by (500 points)
 
Powered by Question2Answer
...