testcontainers / testcontainers/testcontainers-java
[Enhancement]: Create volumes for testcontainers
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 8.7k
- Fork
- 1.9k
- Merge medio
- 2g 17h
- PR unite (30g)
- 9
Descrizione
Module
Core
Proposal
I recently needed to create two test containers that shared data storage. One container would generate data, and the second would read this data. My first thought was to create a docker volume and share the volume in the two containers. This avoids bind mounts which complicates things greatly. Bind mounts are harder to make work cross platform and there are restrictions on bind mounts when I run in my CI tool, bitbucket pipelines.
However, I cannot find any way to do this with testcontainers. There is a way to use withVolumesFrom but there is no way to create the volume as best I can tell. Here is an example of what I was trying to do with test containers but shown with docker commands.
Create a first container with a annonymous volume:
docker run -it --rm --name source --volume=/share ubuntu bash
Create a second container that uses the same volume from the first:
docker run -it --rm --volumes-from source --name dest ubuntu bash
Then in the source container I write a file into the /share directory and I can cat it out in the dest container. I would like to set this up using test containers.
Thanks for this great tool!
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia nel modulo Core tracciando il supporto esistente per withVolumesFrom e le API di configurazione dei container. Confrontali con il comportamento di volume e --volumes-from di Docker descritto nell’issue. Il lavoro è completato quando gli utenti possono creare un volume e condividerlo tra due container di test, in modo che i dati scritti da uno possano essere letti dall’altro.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, java
- Ambito
- testing
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100