how to export mysql database from docker container

4
(2)

In order to export the base from the docker container, we need the ID or the name of the container. List of running containers:

$ sudo docker ps

Example output:

CONTAINER ID   IMAGE                  COMMAND                  CREATED      STATUS      PORTS                    NAMES
ffdfc3e73e82   bitnami/redmine:4      "/opt/bitnami/script…"   8 days ago   Up 4 days   0.0.0.0:8087->3000/tcp   redmine_redmine_1
35fd8ffae686   bitnami/mariadb:10.4   "/opt/bitnami/script…"   8 days ago   Up 7 days   3306/tcp                 redmine_mariadb_1

In our case mysql container name redmine_mariadb_1

Export database:

sudo docker exec -it redmine_mariadb_1 mysqldump -u username -ppassword database > /tmp/redmine.sql

Similar Posts:

1,239

How useful was this post?

Click on a star to rate it!

Average rating 4 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

Scroll to Top