A
A
Andrew2020-02-27 14:21:16
MongoDB
Andrew, 2020-02-27 14:21:16

Where is the data of a database running in a docker container stored?

I have not worked with containers yet, I am just studying the topic. I see that it is quite easy to deploy a container with a mongo (or any other database), and hook a running application to it.

The issue is that the container can be rebuilt, removed, restarted, etc. How to save data?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ivan Shumov, 2020-02-27
@inoise

There are options with volume connection, network drives and other garbage, but Docker developers write in black and white

Don't use Docker for persistent storage

In general, docker is not designed for these tasks. You don't need broken data when the container crashes?

S
Sergey Gornostaev, 2020-02-27
@sergey-gornostaev

If the container was not created by a moron, then the data is stored in an external volume.

V
Vladislav Lyskov, 2020-02-27
@Vlatqa

folder mounting

volumes:
      - ./resource/sql:/tmp/sql
      - ./resource/docker/mysql/data:/var/lib/mysql
      - ./resource/docker/mysql/config:/etc/mysql/conf.d
      - ./log/docker:/var/log/mysql

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question