Sign inSign up

futureys/dump-mysql

By futureys

Updated over 6 years ago

Dump MySQL user databases.

Image
0

262

futureys/dump-mysql repository overview

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.

Tag summary

Content type

Image

Digest

Size

949.5 MB

Last updated

over 6 years ago

docker pull futureys/dump-mysql