'How to create docker-compose file with mysql image to save all data inside volume
I'm trying to write docker-compose file for my Spring boot app for deploy this app on another pc. Here's mine docker-compose file.
version: "3.7"
services:
db:
image: messor2000/mysql
ports:
- "3308:3306"
environment:
MYSQL_DATABASE: web_library
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: password
volumes:
- /var/lib/docker/volumes/e24e69d7db152cea837b440ff02baa627d9d3e44ff9ad4c6ca3e6d1ac09f6a4e/_data
It works almost the way I want it to. I write docker-compose up command on another pc my container with the base is starting(with my bd and all tables in it), but the data from the tables were not transferred. As I know data inside my mysql tables show must be prescribed in volumes: , if this is correct please advise how to correctly spell let to my data. In my situation I have such config in my container mounts:
"Mounts": [
{
"Type": "volume",
"Name": "e24e69d7db152cea837b440ff02baa627d9d3e44ff9ad4c6ca3e6d1ac09f6a4e",
"Source": "/var/lib/docker/volumes/e24e69d7db152cea837b440ff02baa627d9d3e44ff9ad4c6ca3e6d1ac09f6a4e/_data",
"Destination": "/var/lib/mysql",
"Driver": "local",
"Mode": "",
"RW": true,
"Propagation": ""
}
],
So with path show I write to my docker compose file, to solve my problem? I also tried to write in volumes: -/var/lib/mysql Thank you very much
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
