New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port mapping with EXPOSE docker instruction doesn't work #2970

Closed
ston3o opened this Issue Nov 3, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@ston3o
Copy link

ston3o commented Nov 3, 2017

Description of problem

Documentation say "If ports are specified via EXPOSE in your Dockerfile, we will proxy requests to the first port specified. Your application must be configured to listen on that port."

The port binding doesn't work for me even with EXPOSE instruction.

Here my dokku report : http://sprunge.us/WUBX

How was Dokku installed ?

apt-get install dokku

How reproducible

Steps to Reproduce:

docker pull ghost
docker tag ghost dokku/ghost
dokku apps:create ghost
dokku domains:add ghost ghost.mydomaine.com
dokku deploy ghost

Actual Results

502 (Bad Gateway) with error message "We're sorry, but something went wrong."

DOKKU_NGINX_PORT=80
DOKKU_PROXY_PORT_MAP=http:80:5000
PORT=5000

Expected Results

DOKKU_NGINX_PORT=80
DOKKU_PROXY_PORT_MAP=http:80:2368
PORT=2368

@josegonzalez

This comment has been minimized.

Copy link
Member

josegonzalez commented Nov 4, 2017

Can you show the output of a deploy after running the command dokku trace on?

As well, that isn't the workflow for deploying an image. You should be using dokku tags:deploy, as mentioned here.

@ston3o

This comment has been minimized.

Copy link
Author

ston3o commented Nov 4, 2017

@josegonzalez Now I have a different result with dokku tags:deploy command :

DOKKU_DOCKERFILE_PORTS=2368/tcp
DOKKU_NGINX_PORT=80
DOKKU_PROXY_PORT_MAP=http:80:5000
PORT=2368

Expected result : DOKKU_PROXY_PORT_MAP=http:80:2368

Here the output of dokku tags:deploy ghost command : http://sprunge.us/IXHT

@josegonzalez

This comment has been minimized.

Copy link
Member

josegonzalez commented Jan 21, 2018

Ah okay, so what happens here is that when you run:

dokku domains:add ghost ghost.mydomaine.com

That sets the default port map. We don't override that in any case, so what you're seeing is the defaults taking over. If you skip that, then we pull the exposed ports and would set the mapping like so:

DOKKU_PROXY_PORT_MAP=http:2368:2368

When you have a domain available, you can pre-empt this by running the following command:

dokku proxy:ports-add ghost http:2368:2368

In cases where you don't have a domain for your application, you'll need to set the port map afterwards and run dokku ps:rebuild APP. This is a known issue, and we're tracking it in #2903.

We will never use port 80 as the host port if we detect the dockerfile/image has a specific port exposed. This was because it was confusing many of our raw dockerfile users who specified ports for a reason.

The fix here is just better documentation around port handling. I'll see if I can split out all those docs into one cohesive page.

josegonzalez added a commit that referenced this issue Jan 21, 2018

docs: Improve documentation around port handling.
While there are a number of enhancements we could do to make port handling more seamless, this is a first step towards documenting the various oddities around port management for Docker vs Buildpack deploys.

Refs #2903
Closes #2970

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