Only during build-time, container has no access to web-service

Hi all,

I cannot wrap my head around this problem: at runtime, I can download artifacts that are hosted by one of my containers, but at buildtime, I cannot.

About my config: I use docker-compose (v. 1.23.2, build 1110ad01 on MacOS 10.14.4) to build two containers. The first container hosts a service where artifacts can be requested (this container hosts JFrog Artifactory, that in the backend runs a TomCat webserver). The Dockerfile of the second container likes to retrieve one of these artifacts using curl. There is no proxy.

The first container and its hosted service work both perfectly: I’m able to download artifacts from my host-machine as well as from docker containers within my network.

Now comes the crazy thing. During build time, I’m not able to download artifacts:
ERROR: curl: (7) Failed to connect to 172.21.0.3 port 8081: Connection refused

However, when I spin up my intermediately-build-container, I’m able to perform the request and get my artifact.

Any ideas what could be causing this behaviour?

Friendly regards,
Paul