My Go application makes TLS connections via
tls.Dial() to exchange data.
It works fine when run from the host:
But the outgoing connection doesn't seem to work when the app is run from a Docker container. The app hangs indefinitely.
Note 1: Same behavior with using
docker run -p $(docker-machine ip):2500:2500 ...
Note 2: VM doesn't have extra port forwarding settings other than the default settings that came with docker-machine's default VM.
Docker image build with Dockerfile:
FROM golang:latest RUN mkdir -p "$GOPATH/src/path/to/app" # Install dependencies RUN go get github.com/path/to/dep VOLUME "$GOPATH/src/path/to/app" EXPOSE 2500 WORKDIR "$GOPATH/src/path/to/app" CMD ["go", "run", "main.go"]
Host is OS X running docker-machine.
How can I make the TCP outgoing connection to work?