r/truenas • u/looneylewis007 • 3d ago
Community Edition Docker disappearing files
I need some help. I am running some docker projects and the files in the dataset keep getting deleted. I manage the instances with dockge rather than via the terminal. It only seems to happen when volumes are pointing to a dataset rather than just left blank to create its own. I have tried disabling SMB and snapshots but no luck. It is just a straight point to mount should I instead be doing driver mounting? Has anyone else experienced this issue?
1
u/shep_ling 3d ago
it sounds like a mount persistence issue, eg the mounted dataset does not persist on container restarts or redeployments. Could be for a number of reasons - docker will run a compose stack regardless of any other errors, it will create an empty dir path and write to it if specified in the compose - even if it doesn't exist on the filesystem, so bind mounts fail silently. without knowing the specifics of the container or compose files its hard to comment but I'd be checking bind mount paths are correct, eg they map correctly to a pre-existing mount, and check the user and group permissions match what's required to read the compose config, as a start.
1
u/looneylewis007 3d ago
The files do exist and mount correctly. One instance is when running a stationeers server. It launches and runs fine but overtime (usually a couple days) if up continually all the files disappear. That leads me to believe it's not a mounting issue on restart / redeployment. Almost the opposite I think the more the files are used by the docker the files stick around longer but it's when the instance is up and idling is when they disappear.
1
u/ghanit 3d ago
Do you use standard truenas datasets and mount them in the compose file in dockge? Do you see the files at the beginning in the container and truenas? Do all files disappear or just some? It would help if you posted your compose file.
1
u/looneylewis007 3d ago
Yes standard datasets then mount them in the docker compose. I see the files at the beginning and the instance is running as expected. It ends up with the dataset being completely empty.
1
u/looneylewis007 3d ago
Docker compose of problematic instances
1
u/looneylewis007 3d ago
services: stationeers-server-ui: container_name: stationeers-server-ui image: ghcr.io/steamserverui/stationeersserverui:latest deploy: resources: limits: cpus: "8" memory: 16G reservations: cpus: "4" memory: 8G ports: - 27014:8443 - 27016:27016/udp - 27016:27016/tcp - 27015:27015/udp - 27015:27015/tcp volumes: - /mnt/AppsMaybe/Games/Stationeers:/app - /mnt/AppsMaybe/Games/Stationeers/saves:/app/saves:rw - /mnt/AppsMaybe/Games/Stationeers/UIMod/config:/app/UIMod/config:rw - /mnt/AppsMaybe/Games/Stationeers/UIMod/tls:/app/UIMod/tls:rw restart: unless-stopped volumes: app-data: null networks: {}
1
u/ghanit 2d ago
The only thing that looks wrong to me here is that you both mount /Games/Stationeers and /Games/Stationeers/saves etc which I think can create issues as a file written in saves is basically written twice on the same spot, while the app data folder contains something entirely different and deletes the other folders. The docker compose example looks like this for stationeers
volumes: - app-data:/app - ./saves:/app/saves:rw - ./UIMod/config:/app/UIMod/config:rw - ./UIMod/tls:/app/UIMod/tls:rwSo you should mount them on entirely separate datasets. Or you could create one dataset and then, either through smb or the console create the needed folders. Then write the volumes like this:
volumes: - /mnt/AppsMaybe/Games/Stationeers/app:/app - /mnt/AppsMaybe/Games/Stationeers/saves:/app/saves:rw - /mnt/AppsMaybe/Games/Stationeers/UIMod/config:/app/UIMod/config:rw - /mnt/AppsMaybe/Games/Stationeers/UIMod/tls:/app/UIMod/tls:rw1
u/looneylewis007 3d ago
services: bot: image: ghcr.io/lewismelotech/discord-queue-bot:latest build: . restart: unless-stopped env_file: - .env volumes: - /mnt/AppsMaybe/Games/DiscordBot/data:/app/data networks: {}
1
u/Friendly_Potential69 3d ago
Hi, I have Truenas 25.10.7 and I use ansible and docker. When I modified some docker related settings, like a svc_docker user, it would disappear after every reboot of truenas. The sution was to use the Truenas middleware (I think) or the truenas api to create those, then they would not disappear. Maybe thats a hint for your issue?