From e00c98546ff1481cef776ce20736fdd18d91ed25 Mon Sep 17 00:00:00 2001 From: "Francisco R. Del Roio" Date: Tue, 28 Sep 2021 21:19:12 -0300 Subject: [PATCH 1/2] A comment about Dockerfile deployment. I found issues while trying to deploy an app from a dockerfile and I found that the expose instruction causes problems with the dokku proxy. --- docs/getting-started/troubleshooting.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/getting-started/troubleshooting.md b/docs/getting-started/troubleshooting.md index ebecbc6de..ab2a34552 100644 --- a/docs/getting-started/troubleshooting.md +++ b/docs/getting-started/troubleshooting.md @@ -64,6 +64,8 @@ Save the file and try stopping nginx and starting it again: ## * Starting nginx nginx [ OK ] ``` +If you deploy using a *Dockerfile*, this may result in issues at deployment time. The `EXPOSE` instruction may cause your app to be exposed in an incorrect port. Try removing the `EXPOSE` instruction from your dockerfile. + ### I want to deploy my app, but while pushing I get the following error The following error may be emitted from a deploy: From 44a43cb130b97e6d11873d4a9778ca13c9beeba7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 28 Sep 2021 22:25:52 -0400 Subject: [PATCH 2/2] docs: update note to clarify how port mapping works for Dockerfile apps --- docs/getting-started/troubleshooting.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/getting-started/troubleshooting.md b/docs/getting-started/troubleshooting.md index ab2a34552..9402c91e8 100644 --- a/docs/getting-started/troubleshooting.md +++ b/docs/getting-started/troubleshooting.md @@ -64,7 +64,24 @@ Save the file and try stopping nginx and starting it again: ## * Starting nginx nginx [ OK ] ``` -If you deploy using a *Dockerfile*, this may result in issues at deployment time. The `EXPOSE` instruction may cause your app to be exposed in an incorrect port. Try removing the `EXPOSE` instruction from your dockerfile. +--- + +Using the `EXPOSE` directive in a Dockerfile may be another reason why you might see the default site. When the `EXPOSE` directive is in use and a proxy plugin is enabled (the default), the proxy plugin will listen to requests on the ports specified in the `EXPOSE` stanza. + +For example, if you have an `EXPOSE` directive like so: + +```Dockerfile +EXPOSE 8000 +``` + +The proxy port mapping will be `http:8000:8000`. + +To avoid this issue, either of the following can be done: + +- Remove `EXPOSE` directive: This will require respecting the `$PORT` environment variable (automatically set by Dokku). Once that change is deployed, the port mapping should be cleared via the `dokku proxy:ports-clear $APP` command (where `$APP` is your app name). +- Update the port mapping: Updating the port mapping to redirect port `80` to your app's exposed port via `dokku proxy:ports-set $APP http:80:$EXPOSED_PORT` can also fix the issue. This will also allow certificate management and the letsencrypt plugin to work correctly. + +See the [port management documentation](/docs/networking/port-management.md) for more information on how Dokku exposes ports for applications and how you can configure these for your app. ### I want to deploy my app, but while pushing I get the following error