EvilFreelancer/docker-routeros

How To Add Persistent Volumes To Docker Compose File

Closed this issue · 5 comments

Came Across this docker container recently .
Is there a way to add persistent docker volumes to avoid loosing data when the container gores down.

There should be a way to map a certian folder and make it persistent in every build .

Kindly help if possible

Hello, yes you can.

First you need to create a Persistent Volume with help docker volume, then mount this volume to a Docker-container.

When you start your Docker-container, you will need to connect into a shell of container and copy a VDI image from root of container to Persistent Volume folder.

On the next step you need to adjust your entrypoint.sh script to use the path inside the container that's mapped to Persistent Volume.

There is a caveat with this approach regarding ROS updates. Since your ROS environment is running within a QEMU instance, updating the Docker image itself won't directly update the ROS installation inside the VM.

You'll need to manually manage ROS upgrades within the QEMU environment separately.

How about doing so in a Docker compose file ?

Something like this:

volumes:
- ./image:/image

Then:

docker-compose up -d
docker-compose exec ros bash

Then find your VDI and copy to PV, and so on.

Thanks for that @EvilFreelancer .

Glad to help!