Portainer - Lost data from docker containers if container have relative path to volume/file.

Just about everything is virtual these days. Topics relating to virutalization go here.

Moderator: Lillian.W@AST

Post Reply
wolvverine
Posts: 26
youtube meble na wymiar Warszawa
Joined: Tue Dec 12, 2017 5:36 pm

Portainer - Lost data from docker containers if container have relative path to volume/file.

Post by wolvverine »

#43408 Ticket
Portainer - Lost data from docker containers if container have relative path to volume/file.
Created: 05 October 2021

Containers are deployed from Portainer Stack.

After reboot all data in /data/compose are lost (/ is on rootfs)

Portainer puts there data of containers that have a path relative to volumes. In /data/compose.

For every container wirh relative path make place in /data/compose :
com.docker.compose.project.working_dir = /data/compose/[number]
The situation looks twisted.
Portainer uses /data/compose as working_dir (internally in its assigned volume), after container is deploying with relative path, it creates /data/compose directory on host with assigned path for [working_dir]/number/{data_containers_volume].

And problem, because / after reboot is cleaned and with it /data/compose .

Orginal data are in /share/Docker/PortainerCE/data mounted to Portainer.

volumes:
- /share/Docker/PortainerCE/data:/data:rw

But container after deployment search data in /data/compose on host.

Creating a symlink that survives the reboot should be associated with the installation of the Portainer-CE contener.


# ln -s /share/Docker/PortainerCE/data /data
# ls -l
...
lrwxrwxrwx 1 root root 30 Oct 5 03:19 data -> /share/Docker/PortainerCE/data
...

/data/compose is hardcoded in Portainer now.
Post Reply

Return to “Virtualization”