user432024
user432024

Reputation: 4675

Docker build_image cannot reach my local maven repo

Hi running docker: Engine: 17.12.0-ce on Mac 10.12.6

I'm using the build_image feature.

FROM openjdk:8-jdk-alpine AS BUILD_IMAGE

ENV APP_ENVIROMENT=dev
ENV APP_RUNTIME=docker
ENV BUILD_HOME=/build

COPY . $BUILD_HOME
WORKDIR $BUILD_HOME
RUN wget http://xxx.xxx.xxx.xxx:8081

Getting the following error. I'm pretty sure the server is reachable from my laptop/wifi and VPN

...
removing intermediate container e5519d15a106
 ---> b3a3dd24343f
Step 7/16 : RUN wget http://xxx.xxx.xxx.xxx:8081
 ---> Running in 49fdabef0923
Connecting to xxx.xxx.xxx.xxx:8081 (xxx.xxx.xxx.xxx:8081)
wget: can't connect to remote host (xxx.xxx.xxx.xxx): Host is unreachable

Seems like a DNS issue my /etc/resolv.conf is perfectly fine and I'm pretty sure the machine is reachable. Also looks like some machines on my network are reachable while other aren't.

I can test with

RUN ping xxx.xxx.xxx.xxx

Results:

PING xxxxxx.mydomain.com (xxx.xxx.xxx.xxx): 56 data bytes

--- xxxxxx.mydomain.com ping statistics ---
4 packets transmitted, 0 packets received, 100% packet loss
The command '/bin/sh -c ping -c 4 xxxxxx.mydomain.com' returned a non-zero code: 1

Update. Added names to be clear.

FROM openjdk:8-jdk-alpine AS BUILD_IMAGE

ENV APP_ENVIROMENT=dev
ENV APP_RUNTIME=docker
ENV BUILD_HOME=/build

COPY . $BUILD_HOME
WORKDIR $BUILD_HOME
RUN wget http://myserver.domain.net:8081

The result of docker build:

 ---> 76c263fb4490
Step 7/15 : RUN wget http://myserver.domain.net:8081
 ---> Running in ef2b13c77b91
Connecting to myserver.domain.net:8081 (10.0.0.1:8081) <-- I.P redacted to protect the inocent. :p
wget: can't connect to remote host (10.0.0.1): Host is unreachable
The command '/bin/sh -c wget http://myserver.domain.net:8081' returned a non-zero code: 1

From my console...

wget http://myserver.domain.net:8081                                                                                      
--2018-02-15 10:36:44--  http://myserver.domain.net:8081/
Resolving myserver.domain.net... 10.0.0.1
Connecting to myserver.domain.net|10.0.0.1|:8081... connected.
HTTP request sent, awaiting response... 200 OK

Clearly you can see docker is resolving the I.P and that my laptop can connect.

Upvotes: 2

Views: 546

Answers (1)

user432024
user432024

Reputation: 4675

Problem solved as per: https://success.docker.com/article/How_do_I_configure_the_default_bridge_(docker0)_network_for_Docker_Engine_to_a_different_subnet

The docker bridge was conflicting with my network. We need to make an entry in daemon.json

{
    "bip": "172.26.0.1/16"
}

You can use any value that is suitable for you.

Upvotes: 1

Related Questions