Giter VIP home page Giter VIP logo

Comments (5)

ucan-lab avatar ucan-lab commented on September 17, 2024

The top-level volume is specified in compose.yaml.
Even if you destroy a container, the data in the volume remains.

volumes:
  db-store:

  db:
    volumes:
      - type: volume
        source: db-store
        target: /var/lib/mysql
        volume:
          nocopy: true

from docker-laravel.

vahidalvandi avatar vahidalvandi commented on September 17, 2024

Is it possible to move the volume to another server? If it is not possible, it is better to save it locally

from docker-laravel.

ucan-lab avatar ucan-lab commented on September 17, 2024

@vahidalvandi I can't think of any use case where I would like to store the volume on another server.
I don't think you should directly touch files under /var/lib/mysql except in special cases.
I set it as a volume to prevent users from touching /var/lib/mysql.

If you want to extract MySQL data, I recommend using mysqldump to back up and restore it.

Backup

$ docker compose exec db bash -c 'mysqldump --no-tablespaces -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE > /tmp/dump.sql'
$ docker compose cp db:/tmp/dump.sql /tmp/dump.sql

Restore

$ docker compose cp /tmp/dump.sql db:/tmp/dump.sql
$ docker compose exec db bash -c 'mysql -u $MYSQL_USER -p$MYSQL_PASSWORD $MYSQL_DATABASE < /tmp/dump.sql'
$ rm /tmp/dump.sql

from docker-laravel.

vahidalvandi avatar vahidalvandi commented on September 17, 2024

i use this container for automatic backup

  backup:
    image: ghcr.io/realorangeone/db-auto-backup:latest
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - ./backups:/var/backups
    environment:
      - SUCCESS_HOOK_URL=
      - INCLUDE_LOGS=true

from docker-laravel.

ucan-lab avatar ucan-lab commented on September 17, 2024

I have considered it, but have no plans to introduce it in this repository.

from docker-laravel.

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.