testcontainers / testcontainers/testcontainers-java
Option to ignore ports in docker-compose files
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 8.7k
- Fork
- 1.9k
- Merge medio
- 2g 17h
- PR unite (30g)
- 9
Descrizione
When using DockerComposeContainer to launch an existing docker-compose file, Testcontainers expose random ports for the services, which can be picked up with the .getServicePort(..., ...) method.
However, if the docker-compose file includes ports definitions, Testcontainers will also expose those fixed ports, defeating the purpose of avoiding collisions by randomizing ports.
I am aware that the documentations states that "it is not necessary to define ports to be exposed in the YAML file; this would inhibit reuse/inclusion of the file in other contexts". But at the same time, DockerComposeContainer is meant to be used in situations where docker-compose files are already in use, and for me, it is convenient that those existing docker-compose files do include the port definitions.
So it would be convenient if Testcontainers could simply ignore the ports in the docker-compose files, and only expose the randomly assigned numbers. As far as I can see, this is not currently an option(?)
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 tracciando DockerComposeContainer e la gestione di getServicePort(...) per individuare dove vengono esposte le porte provenienti da un file Compose esistente. Controlla gli attuali test di integrazione di Docker Compose, quindi definisci completion come un’opzione che ignori le porte fisse, mantenga le porte del servizio assegnate casualmente ed eviti le collisioni tra le porte dell’host.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, docker-compose, java
- Ambito
- devops, testing
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100