Docker, I installed it and everything is working!
I installed a mongodb
Now the question is:
1. I need to modify mongodb’s configuration file in the container
How do I modify this file, vi command container not! (Note that I want to keep this configuration for a long time. Is it only possible to make it a mirror image)
2. How do I download this file to the local, that is, from the container to the local computer!
3. I now want to set the mongodb database file to be saved in the /root/shuju/mongodb folder (not in the container) on the server computer.
In this way, I can safely back up the database. (or how to back up the database that has been running for a period of time from the container and download it to the local computer! How to upload it to the container for recovery later)
There is no need for a detailed tutorial, just tell me about how to operate it.
My own understanding is: to use a data volume, create a new /root/shuju/mongodb locally, then mount it in the data/db folder in the container, and then save the mongodb database to data/db! (Better give me an order)
Installing vim requires rebuilding the Docker image
Dockerfile is as follows:
FROM mongo RUN apt-get update && apt-get install -y vim
Use the following command to rebuild the Docker image:
sudo docker build -t mongo:test .
Data can be saved in a local directory using the Docker data volume
sudo docker run -itd \ -v /root/shuju/mongodb:/data/db \ --name mongo \ mongo:test