Comments (3)
I managed to do it using volumes
.
The idea is to first create a volume via
docker volume create my_volume
Then mount the volume when running the container in a similar way as it's done with bind
, except you indicate the volume type:
docker run --name xamppContainer -p 41061:22 -p 41062:80 -d --mount type=volume,source=my_volume,target=/opt/lampp/var/mysql -v ~/path/to/apache_conf:/opt/lampp/apache2/conf.d -v ~/path/to/www:/www xamppImage:latest
You can inspect the volume via docker volume inspect my_volume
to find the path where the volume data is stored.
To save the MyISAM table folders and InnoDB blocks, I set the volume target (in the mount option) to /opt/lampp/var/mysql
. The volume driver will populate the volume if the container has files at the target location, which is the case. The volume will keep the persistent data and can be shared with other containers.
See @tomsik68 's link suggestion https://docs.docker.com/storage/volumes/ to find more information regarding volumes.
Note: I'm using podman instead of docker, but the solution is the same.
from docker-xampp.
Hello, I'm sorry to hear you lost your database. This container is really intended just for development purposes where the database doesn't need to be preserved.
I believe you need to use Docker volumes to persist data between container migrations. Sorry to say that I don't know how to do that myself. Please refer to the Docker volume reference to find out more.
from docker-xampp.
Thank you for sharing the solution!
from docker-xampp.
Related Issues (20)
- How can I access /www of the container proFTPd ? HOT 2
- Happy work next version with these features as these years work practice HOT 1
- docker-compose.yml sample file
- Update to the latest XAMPP versions HOT 1
- [Question] Setting up DVWA on docker-xampp HOT 1
- how to install "ixed.8.1.lin" loader from the SourceGuardian site HOT 2
- Unknown command or add-on HOT 2
- How do I install a PHP module like IMAGICK? HOT 2
- I want to mount my php folder so i can open the page on it. HOT 13
- It does not copy the source files from the directory to the /www being mounted HOT 7
- Separate mysql socket of mysql data HOT 1
- XAMPP running as `daemon` user instead of `www-data` HOT 2
- Mount existing db to container HOT 2
- Mysql is not starting HOT 7
- disable mysql? HOT 2
- Add 8.3.6 HOT 2
- cant remap ports to container HOT 4
- denied HOT 1
- Path Problem HOT 3
- Install xdebug HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-xampp.