Skip to content

Instantly share code, notes, and snippets.

@tksugimoto
Created December 20, 2018 04:14
Show Gist options
  • Save tksugimoto/1b556aa0f4cccbfa39690ad54e4263ff to your computer and use it in GitHub Desktop.
Save tksugimoto/1b556aa0f4cccbfa39690ad54e4263ff to your computer and use it in GitHub Desktop.
dockerコンテナで動いているmariadbでmysqldump

$ winpty docker-compose.exe exec mariadb bash
root@5da26f38c385:/# mysqldump -u root <schema名> -p > /tmp/dump.sql

$ docker ps | grep -E "mariadb|IMAGE"

docker ps | grep -E "mariadb|IMAGE"
CONTAINER ID        IMAGE                           COMMAND                  CREATED             STATUS              PORTS                                                NAMES
5da26f38c385        mariadb:10.3.2                  "docker-entrypoint.s…"   2 hours ago         Up 2 hours          127.0.0.1:3306->3306/tcp                             xxxxxx_mariadb_1

$ docker cp <コンテナID>:/tmp/dump.sql .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment