Home > other >  Database on the docker restart when lost
Database on the docker restart when lost

Time:09-25

I'm using Windows and run on Docker Influxdb and grafana.
Every time I close the Docker, I will be lost database.
This is what I know:
I try to keep strategies, but have no effect on the result & gt; I can shut down and restart the container (docker - compose down), the database is still there. It was only when I close the docker for Windows, and I'll lost database. & gt; When I create a new database (/data/Influxdb/data/), I can't see any new folder in the mapping directory. Only '_internal' folder still exists, I think that correspond to the persistent database called '_internal'
This is my yml file. Any help thank you very much.

Version: '3'

Services:
# Define an InfluxDB service
Influxdb:
Image: influxdb
Volumes,
-./data/influxdb:/var/lib/influxdb
Ports:
- "8086-8086
"- "80-80
"- "8083-8083
"Grafana:
Image: grafana/grafana
Volumes,
-./data/grafana:/var/lib/grafana
Container_name: grafana
Ports:
- "3000-3000
"Env_file:
- 'env. Grafana'
Links:
- influxdb
# Define a service for using the influx CLI tool.
# docker - compose the run influxdb - cli
Influxdb - cli:
Image: influxdb
Entrypoint:
- influx
- host
- influxdb
Links:
- influxdb

CodePudding user response:

If you are using docker - compose the down/up, please remember this is not a "reset", because:
Docker - compose up to create a new container and & gt; Docker - compose down delete them:

Docker - compose up
Builds, (re) creates and starts, and attaches to containers for a service.
Docker - compose down
Stops containers and removes containers, networks, volumes, and images created by the up.

On the other hand, if you continue to use:
Docker - compose start> Docker - compose stop> Docker - compose restart
You deal with the same container, when you run the docker - compose is created when the container.

CodePudding user response:

Docker ps - a
Docker restart id

CodePudding user response:

https://blog.csdn.net/hnw13938056090/article/details/105359575
  • Related