hotel icon indicating copy to clipboard operation
hotel copied to clipboard

Resolving http requests to hotel from within a docker container

Open airtonix opened this issue 8 years ago • 2 comments

workstation

  • hotel
    • ~/.hotel/servers/concourse.json {target: 'http://ip-of-mobyvm:8080'}
    • ~/.hotel/servers/ui.concourse.json {target: 'http://ip-of-mobyvm:4000'}
  • hyperv
    • mobyvm
      • docker
        • concourse/concourse $ web -> port 8080
        • alpine-node:6.10.0 $ nuxt dev -> port 4000
#  in alpine-node:6.10.0 container
$ curl http://concourse.dev
curl: (7) Failed to connect to concourse.dev port 80: Connection refused
$ nslookup concourse.dev
nslookup: can't resolve '(null)': Name does not resolve

Name:      concourse.dev
Address 1: 127.0.53.53

My other option isn't that great: running a dnsmasq container, change my wifi interface dns settings in windows 10 to statically point at the mobyvm, then manage dns records with dnsmasq.

airtonix avatar Dec 06 '17 09:12 airtonix

~ $ docker run --rm -it alpine /bin/sh
Unable to find image 'alpine:latest' locally
latest: Pulling from library/alpine
2fdfe1cd78c2: Pull complete
Digest: sha256:ccba511b1d6b5f1d83825a94f9d5b05528db456d9cf14a1ea1db892c939cda64
Status: Downloaded newer image for alpine:latest
/ # HTTP_PROXY=http://192.168.0.102 curl concourse.dev
/bin/sh: curl: not found
/ # apk --update add curl
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
(1/4) Installing ca-certificates (20171114-r0)
(2/4) Installing libssh2 (1.8.0-r2)
(3/4) Installing libcurl (7.57.0-r0)
(4/4) Installing curl (7.57.0-r0)
Executing busybox-1.27.2-r6.trigger
Executing ca-certificates-20171114-r0.trigger
OK: 6 MiB in 15 packages
/ # HTTP_PROXY=http://192.168.0.102 curl concourse.dev
curl: (7) Failed to connect to concourse.dev port 80: Connection refused
/ # HTTP_PROXY=http://192.168.0.102:2000/proxy.pac curl concourse.dev
curl: (7) Failed to connect to concourse.dev port 80: Connection refused
/ # HTTP_PROXY=http://192.168.0.102:2000 curl concourse.dev
curl: (7) Failed to connect to concourse.dev port 80: Connection refused

airtonix avatar Dec 06 '17 09:12 airtonix

You must start the container already with the proxy configuration.

Please see https://docs.docker.com/network/proxy/

If this works, please consider to add a section to the README or the wiki.

tmaier avatar Apr 12 '18 22:04 tmaier