Reputation: 402
I have a docker compose file with an image that runs an npm install.
services:
test:
image: company.com/myImage:1.0.2
environment:
- HTTP_PROXY=http://proxy.com:8080
- HTTPS_PROXY=http://proxy.com:8080
Running docker-compose -f ./docker/docker.build.yaml up
fails during the install with some type of dns issue
npm verb stack FetchError: request to https://company.com/artifactory/api/npm/npm-remote/lodash.merge failed, reason: getaddrinfo EAI_AGAIN company.com
however,
Running docker run company.com/myImage:1.0.2
works
npm http fetch GET 200 https://company.com/artifactory/api/npm/npm-remote/lodash.merge/-/lodash.merge-4.6.2.tgz 95ms
My company uses a proxy to connect to the internet so my local environment variables contain some proxy env vars. I tried hardcoding those env vars into the docker compose file but the result stayed the same.
What am I missing?
edit: added env vars I tested with to compose file
Upvotes: 0
Views: 52
Reputation: 402
docker cli by default uses the docker host
network whereas docker-compose was creating it's own docker_default
network. My solution lied in specifying the docker network in the compose file
services:
test:
image: whatever
network_mode: "host"
Upvotes: 0