Reputation: 65
I messed up really badly, started a prestashop docker container (via compose) for production and forgot to add a persistent volume to it. I've set up my store and now all my data is dangling. I need to somehow convert my current docker container to one with persistent volume.
I've copied all data from current container to a local folder, created a new compose file and everything would work if I chmod -R 777
whole directory but people go to hell for these types of crimes, so that's not an option.
As I'm not an expert, I have no other ideas.
Upvotes: 1
Views: 1067
Reputation: 65
Alright,
So it was a pretty simple solution:
sudo su
docker inspect container
take the long string hash 822adf62adsomethingsomething
.cd /var/lib/docker/overlay2/822adf62adsomethingsomething/merged
. There you have all your docker container files.cp -a whateveryouwant /whereeveryouwant
as cp -a
keeps permissions and owners intact.Upvotes: 1
Reputation: 5557
The issue you have is most probably related to the user id / group id that is owning the files from the old container. When you move to the new container, if the IDs are not same you will have problem, so chmod -R 777
is fixing this problem, but the gates of hell are wide open.
It's better to understand which user id and group id should be the owners of the files and use chown
and chgrp
to set the right owners from the new container.
Upvotes: 1