I have a docker volume called influxdb_volume which is physically stored on a mounted external drive (because the docker volume takes up considerable disk space). Previously, this volume was used by a container without problem. However, now I have had to reinstall both the host OS and therefore docker itself, but would now like to reuse this previously created volume.
Is this possible in a simple native docker way (without copying all the data across to a temporary volume using a temporary container) ?
Here is the docker-compose.yaml file:
version: "3"
services:
influxdb:
image: influxdb:1.8
container_name: influxdb_container
restart: always
ports:
- 8086:8086
networks:
- docker_monitoring_network
volumes:
- influxdb_volume:/var/lib/influxdb
networks:
docker_monitoring_network:
external: true
volumes:
influxdb_volume:
external: true
and on the previous system I created the docker volume (as described here) using:
docker volume create --driver local \
--opt type=none \
--opt device=/mnt/SSD_240GB/docker_data/InfluxDB \
--opt o=bind influxdb_volume
The issue at the moment is that there are no registered volumes (i.e. running docker volume ls
returns nothing.
Ultimately, running docker-compose up
gives the following error:
ERROR: Volume influxdb_volume declared as external, but could not be found. Please create the volume manually using `docker volume create --name=influxdb_volume` and try again.
Running another docker volume create
as before, and then using the same docker-compose file removes the error, but the data is not appearing in the container. However if I manually run the image (without docker compose) as follows, then it works:
docker run -p 8086:8086 --name influxdb_container -v influxdb_volume:/var/lib/influxdb -d influxdb:1.8
Thank you.