简体   繁体   中英

How to find host of docker-compose running in gitlab

I'm using docker-compose to run integration tests. The integration tests take the host (or ip) of the webservice container (running in docker-compose)in order to test the application. Hence, need to find the host the container is running on (when running docker-compose in gitlab ci). When running locally, I use "localhost", when running plain docker in gitlab ci, I use "docker", but these do not work when running docker compose. I have a few thoughts, can you please offer advice on which is preferable, or provide other options: 1 - assigning a network in docker-compose so that the application gets a static ip, and I connect to that 2 - use docker inspect to dynamically find the ip of the service running 3 - find a static host (such as "docker-compose") and use this.

Please advise, Connor

我建议在您的 docker-compose 文件中分配一个网络,并为您的所有服务设置一个静态 IP。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM