Skip to content

Conversation

@trstephen
Copy link
Member

@trstephen trstephen commented Jan 15, 2017

Throwing this up for some feedback.

The dockerfile successfully builds an interactive(-ish) version of the app. This command will build the image and give you a shell to poke the application

# start an interactive container
$ docker run --name quoteserv --rm -ti fake-quoteserv /bin/sh

# start the server in the background
/go $ nohup ./bin/fake-quoteserv &

# send request
/go $ nc localhost 4443 # press <Enter>
hello,friend # press <Enter>

# response
567.46,hello,friend,1484507171,aGVsbG9mcmllbmTvv70=

However, I can't interact with the container from the outside.

$ make start
$ docker logs quoteserv
Listening on localhost:4443
$ nc localhost 4443
$ # no response from server, last command returned nonzero code
$ docker logs quoteserv
Listening on localhost:4443
# should see something like 'Received message 127.0.0.1:37506 -> 127.0.0.1:4443' if it worked

According this this golang blog post about deploying servers in containers, this command should work:

$ docker run --publish 4443:4443 --name quoteserv --rm fake-quoteserv

The server will start but it won't accept any connections from the outside 😕. The container seems to be configured as expected:

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
01f686594a39        fake-quoteserv      "/bin/sh -c $GOPATH/b"   About a minute ago   Up About a minute   0.0.0.0:4443->4443/tcp   quoteserv

$ docker logs quoteserv
Listening on localhost:4443

Troubleshooting

I've got two ideas what might be wrong:

  • I'm not hitting the correct IP to connect to the container
    • I think i've attached things correctly, given 0.0.0.0:4443->4443/tcp from docker ps
    • If I find the IP the container has attached to and try to send that there's still no response
      • docker inspect -f '{{ .NetworkSettings.IPAddress }}' quoteserv
  • My app configuration is preventing the server from looking for outside connections

🤔
@JakeCooper @JordanVlieg

- Update all refs 4444 -> 4443
@JakeCooper
Copy link
Member

Tossed the labels since the deploy environment seems to be unknown ATM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants