Persistent Volumes / Bind Mounts when using docker #1715
Replies: 8 comments
-
Hello there, You need to map the volume, in webkul/krayin image everything is packed inside, something like this, docker run -it -d -p 8082:80 \
-v /path/on/host:/var/www/html \
-v /path/on/host/mysql:/var/lib/mysql \
webkul/krayin:2.0.1 Or you can use our Krayin docker repo also, |
Beta Was this translation helpful? Give feedback.
-
Hi, I have made the relevant changes as suggested and my docker compose is now the following:
The container starts but the log seems to be show MYSQL is starting and then stopping a second later.
Any suggestions would be much appreciated. |
Beta Was this translation helpful? Give feedback.
-
May be this path creating an issue,
Can you check by removing this path. If working fine then you should check mysql volume map path. |
Beta Was this translation helpful? Give feedback.
-
Hi, I've commented out the database volume as you suggested and the container starts however get the following via the web browser
Looking at the log (see below) it looks exactly the same as if I comment out both the HTML and MYSQL bind mounts. The container then starts and I can login but there is no persistence so rebooting the container will lose any changes.
Any further assistance on this would be much appreciated. Many Thanks |
Beta Was this translation helpful? Give feedback.
-
There is no issue in the log. For persistence, you need proper volume mapping. Check the volume map path for MySQL, as the path may be incorrect when mapping MySQL. |
Beta Was this translation helpful? Give feedback.
-
There is no issue with mapping the bind mounts as the container wouldn't start if they didn't exist. I have also tried chmod 777 on both directory to ensure it isn't a permission issue. Looking at the host via VSCode I can the html folder has the following files once the container starts:
And In the mysql folder I can also see the follow files:
So it seems the container can write to the directory OK. Any other suggestions would be much appreciated. |
Beta Was this translation helpful? Give feedback.
-
After some investigation I can see that the www-data user/group inside the container was using id's 33:33 and msql was using 104/105. I tried to Chown on the host but this still didn't seem to work. I have then tried using docker volume approach with the following compose file which seems to retain the persistent data after a reboot. My preferred option would be to use bind mounts so i can access the raw data on the host.
Happy to try any more suggestions in the mean time. |
Beta Was this translation helpful? Give feedback.
-
If this is working fine, you can try replacing the path with |
Beta Was this translation helpful? Give feedback.
-
Hi,
Following the below steps from this page: https://devdocs.krayincrm.com/2.0/introduction/docker.html#introduction I'm able to fire up a running container without issue.
However if I stop or reboot the container all changes are lost and nothing seems persistent. I have tried bind mounting "app" and "dbvolume" as suggested but this doesn't seem to be working. Could someone point me in the right direction of what file path inside the container I would need to mount to the host to retain persistent data.
Many Thanks
Beta Was this translation helpful? Give feedback.
All reactions