Hi! I'm using docker-compose, I wanna start mysql with volume(hello for example). And I wanna drop all changes after stopping.... For running tests. I make changes stop & start - changes here. How to do it?
localdb2:
image: mysql:5.6.27
volumes:
- hello:/var/lib/mysql
docker-compose down -v will remove volumes.
docker-compose down -v will remove volumes.
After up same!
hello is volume, created and prepeared before(docker volume create hello)
Oh, external volumes are not removed. If you created the volume, you must remove it yourself (docker volume rm hello)
In my case, I would like to see that feature. Right now I'm building pipeline or some process, that at the moment preferred to be executed at swarm on a single node. Each step of the pipeline is separate docker image (one process per container, etc). Some of them use volumes for the intercommunication. Some of them using networking ofc.
We tried to solve our task with pipe files, but it seems the best approach is to have shared volume and inotify hook. Right now everything is working perfectly, we using AWS CloudFormation to spin on a node, and then start the pipeline. However, the warmup is taking too long (because of the complexity of the process, docker images are huge and cannot be significantly reduced).
That's why we looking at the approach of keeping a node up for a while, and in case of a new workload, the instance going to be reused. In order to avoid any conflicts, we removing any volumes content before restarting the workers.
By nature of our task, some of the volumes may reuse data from any similar job done. Baking data into images would not make sense, because it's getting updates from time to time. (Like caches of external source, unable to explain without breaking any terms).
Ofc in managing script we could remove some volumes and do not touch others, but I was thinking if the option such as temporary volumes could be easily implemented. My guess - it should persist as long as at least one container is connected to it.
Every operating system has some implementation of tmpfs, and it seems rationale that at some point docker user going to ask about it. In our case, we would like to have tmpfs shared between images. That's a non-trivial task. I would like to see that feature available with docker-compose at a stack development stage.
Maybe an orchestration is a key, and I'm open-minded for suggestions. Thank you for your time!
version: '3.7'
services:
a:
image: alpine
volumes:
- tmp:/shared
b:
image: alpine
volumes:
- tmp:/shared
volumes:
tmp:
tmpfs: true # temporary: true
Most helpful comment
In my case, I would like to see that feature. Right now I'm building pipeline or some process, that at the moment preferred to be executed at swarm on a single node. Each step of the pipeline is separate docker image (one process per container, etc). Some of them use volumes for the intercommunication. Some of them using networking ofc.
We tried to solve our task with pipe files, but it seems the best approach is to have shared volume and inotify hook. Right now everything is working perfectly, we using AWS CloudFormation to spin on a node, and then start the pipeline. However, the warmup is taking too long (because of the complexity of the process, docker images are huge and cannot be significantly reduced).
That's why we looking at the approach of keeping a node up for a while, and in case of a new workload, the instance going to be reused. In order to avoid any conflicts, we removing any volumes content before restarting the workers.
By nature of our task, some of the volumes may reuse data from any similar job done. Baking data into images would not make sense, because it's getting updates from time to time. (Like caches of external source, unable to explain without breaking any terms).
Ofc in managing script we could remove some volumes and do not touch others, but I was thinking if the option such as temporary volumes could be easily implemented. My guess - it should persist as long as at least one container is connected to it.
Every operating system has some implementation of tmpfs, and it seems rationale that at some point docker user going to ask about it. In our case, we would like to have tmpfs shared between images. That's a non-trivial task. I would like to see that feature available with docker-compose at a stack development stage.
Maybe an orchestration is a key, and I'm open-minded for suggestions. Thank you for your time!