Code Monkey home page Code Monkey logo

Comments (3)

romarcg avatar romarcg commented on September 14, 2024 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.

tomsik68 avatar tomsik68 commented on September 14, 2024

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.

tomsik68 avatar tomsik68 commented on September 14, 2024

Thank you for sharing the solution!

from docker-xampp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.