Docker installation does not expose ports to outside world


(Patrick Paul) #1

I’ve completed the steps for the docker install. However, I’m unable to connect to the Discourse application from the outside world or host machine. (E.g. telnet localhost 8001 fails.)

In my app.yml:

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
expose:
  - "8001:80"   # http
#  - "443:443" # https

Performing ./launcher rebuild app indicates this docker command:

usr/bin/docker run -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_MALLOC_LIMIT=40000000 -e RUBY_HEAP_MIN_SLOTS=800000 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e DISCOURSE_HOSTNAME=************* -e DISCOURSE_DEVELOPER_EMAILS=***************** -e DISCOURSE_SMTP_ADDRESS=************** -e DISCOURSE_SMTP_USER_NAME=******************* -e DISCOURSE_SMTP_PASSWORD=************* -e LETSENCRYPT_ACCOUNT_EMAIL=********* -h jupiter-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log local_discourse/app /sbin/boot

The docker command appears to missing any expose or port command switch, so I checked docker ps:

admin@jupiter:/var/discourse(master)$ docker ps
CONTAINER ID        IMAGE                 COMMAND             CREATED             STATUS              PORTS               NAMES
07b612f1f4fc        local_discourse/app   "/sbin/boot"        18 minutes ago      Up 13 minutes                           app

This shows there are no ports exposed?

Finally, to verify Discourse was in fact working inside the host I performed ./launcher enter app:

root@jupiter-app:/var/www/discourse# wget localhost:80
--2016-04-27 18:31:20--  http://localhost/
Resolving localhost (localhost)... ::1, 127.0.0.1
Connecting to localhost (localhost)|::1|:80... failed: Connection refused.
Connecting to localhost (localhost)|127.0.0.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: ‘index.html’

    [ <=>                                                                         ] 18,634      --.-K/s   in 0.009s  

2016-04-27 18:31:20 (1.92 MB/s) - ‘index.html’ saved [18634]

root@jupiter-app:/var/www/discourse# 

Any ideas? Thanks!


(Rafael dos Santos Silva) #2

Are u on the latest update?

https://meta.discourse.org/t/upgraded-docker-site-brokedown/43328/8?u=falco&source_topic_id=43344

(Patrick Paul) #3

@Falco Thanks, indeed and pulling latest git fixed it. I had quickly searched forums but didn’t see anything immediately helpful. Working now!


(Jeff Atwood) #4