Coder Social home page Coder Social logo

dockerfile-dump-mysql's Introduction

docker build automated? docker build passing? image size and number of layers

What is Dump MySQL?

This is batch task to dump only user databases from MySQL.

In some case like upgrading MySQL version, When dump includes system databases, importing dump may fail.

There are also several way to back up MySQL databases:

However, they are the way for full backup, we need the way to dump only user databases.

How to use this image

1.

Prepare file to load environment variables, for example, let's name env.list:

LOGIN_USER=root
LOGIN_PASSWORD=p@ssW0rd
LOGIN_HOST=database

* cf. Set environment variables (-e, --env, --env-file) | docker run | Docker Documentation

2.

Run following command:

docker run --env-file env.list --network some-network --rm -v $(pwd)/backup:/root/storage futureys/dump-mysql

Then, user databases are dumped in ./backup directory on host.

... via docker-compose

1.

Assume that following docker-compose.yml are upping:

---
version: '3.7'
services:
  database:
    container_name: database
    environment:
      MYSQL_ROOT_PASSWORD: ${DATABASE_ROOT_PASSWORD}
      MYSQL_DATABASE: service
    image: mysql
  # ...

2.

Prepare docker-compose.dump.yml:

---
version: '3.7'
services:
  dump:
    container_name: dump
    image: futureys/dump-mysql
    environment:
      LOGIN_USER: root
      LOGIN_PASSWORD: ${DATABASE_ROOT_PASSWORD}
      LOGIN_HOST: database
    volumes:
      - ./backup:/root/storage

3.

Run following command:

docker-compose -f docker-compose.yml -f docker-compose.dump.yml run --rm dump

Then, user databases are dumped in ./backup directory on host.

Environment Variables

LOGIN_USER

Login user name for MySQL to dump. Required.

LOGIN_PASSWORD

Login user password for MySQL to dump. Required.

LOGIN_HOST

Host name of MySQL to dump. Optional. Default value: database

LOGIN_PORT

Port number of MySQL to dump. Optional. Default value: 3306

License

View license information for the software contained in this image.

As with all Docker images, these likely also contain other software which may be under other licenses (such as Bash, etc from the base distribution, along with any direct or indirect dependencies of the primary software being contained).

As for any pre-built image usage, it is the image user's responsibility to ensure that any use of this image complies with any relevant licenses for all software contained within.

dockerfile-dump-mysql's People

Contributors

yukihiko-shinoda avatar

Watchers

 avatar

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.