how to export mysql database from docker container


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>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:


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
Scroll to Top