Skip to content
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

Description of EXPOSE instruction is unclear #1499

Closed
lorin opened this issue Feb 4, 2017 · 10 comments
Closed

Description of EXPOSE instruction is unclear #1499

lorin opened this issue Feb 4, 2017 · 10 comments
Labels
area/engine Issue affects Docker engine/daemon lifecycle/locked

Comments

@lorin
Copy link

lorin commented Feb 4, 2017

Problem description

I can't figure out when I would ever need to EXPOSE a port. the docs say:

The EXPOSE instruction informs Docker that the container listens on the specified network ports at runtime.

But why do I need to inform Docker about which network ports a container will listen to at runtime? I apparently don't need to expose a port to publish it at runtime (or do I?). I also apparently don't need to expose a port to have Docker containers communicate over a Docker network (or do I?).

Apparently, it was once required for legacy Docker links, but those have been deprecated, so should this be deprecated? If not, why not?

Problem location

Suggestions for a fix

As best as I can tell, the only real purpose EXPOSE has is to document in the Dockerfile which port the service is listening on. If that is the case, I would suggest something like:

Currently, the EXPOSE instruction's only purpose is to document in the Dockerfile which port the service will listen on. The instruction is also required for the deprecated legacy container links feature.

If that's not true, please clarify!

aaronlehmann pushed a commit to aaronlehmann/docker.github.io that referenced this issue Feb 14, 2017
Since UCP already configures engine-discovery, there is no need
to mention this on the deploy app docs.
Fixes docker#1499
aaronlehmann pushed a commit to aaronlehmann/docker.github.io that referenced this issue Feb 14, 2017
Since UCP already configures engine-discovery, there is no need
to mention this on the deploy app docs.
Fixes docker#1499
@mdlinville mdlinville added area/engine Issue affects Docker engine/daemon hackathon labels Apr 4, 2017
@johndmulhausen johndmulhausen modified the milestone: Austin 2017 Hackathon Apr 12, 2017
@unbreakableIce
Copy link

dibs for the hackathon

@mdlinville
Copy link

No action for two days, so this is up for grabs!

However, this may have been addressed by #2882

@clocklear
Copy link
Contributor

@mstanleyjones looks as though #2882 does address this:

You expose ports using the EXPOSE keyword in the Dockerfile or the
--expose flag to docker run. Exposing ports is a way of documenting which
ports are used, but does not actually map or open any ports. Exposing ports
is optional.

noop?

@mdlinville
Copy link

Thanks @clocklear

@sarusso
Copy link

sarusso commented Aug 22, 2017

The doc here: https://docs.docker.com/engine/reference/builder/#expose is still very misleading. The sentence "Exposing ports is a way of documenting which ports are used, but does not actually map or open any ports. Exposing ports is optional." is very clear IMHO and should be put there. This issue should be re-opened...

@mdlinville
Copy link

@sarusso sorry, the doc you reference is actually sourced straight from the docker/cli repository so is you think that the file should be changed, the issue needs to be raised there.

@johndmulhausen can we re-fix it so that the "Report an issue" for these external topics goes to the right place again?

@sarusso
Copy link

sarusso commented Aug 22, 2017

@mstanleyjones is it? The readme of this repository states on the first line that "this is the source for https://docs.docker.com", which is the source of the document I referenced. Why this inconsistency then?

@mdlinville
Copy link

If you look in our repository you will see that we don't have the corresponding Markdown file in our repository at all. We fetch it as part of our build process (see the script). Also, if you look at the source of the file in the docker/cli repository, you will see the following comment:

<!-- This file is maintained within the docker/cli Github
     repository at https://github.com/docker/cli/. Make all
     pull requests against that repo. If you see this file in
     another repository, consider it read-only there, as it will
     periodically be overwritten by the definitive file. Pull
     requests which include edits to this file in other repositories
     will be rejected.
-->

@sarusso
Copy link

sarusso commented Aug 22, 2017

@mstanleyjones Look, I saw a issue with the doc, wanted to help/contribute, found this issue here (which was started as an issue referencing the same doc I did by the way), I double-checked on the readme if I were in the right place, and discovered after commenting that I was actually in the wrong one. I did not dig into the repo to triple-check, and I honestly don't think that it should have been my responsibility to do so. There is no need to prove me wrong, just take it as a feedback from a user (me): it is not clear.

@docker-robott
Copy link
Collaborator

Closed issues are locked after 30 days of inactivity.
This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

/lifecycle locked

@docker docker locked and limited conversation to collaborators Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/engine Issue affects Docker engine/daemon lifecycle/locked
Projects
None yet
Development

No branches or pull requests

8 participants