Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

What is the syntax of the Dockerfile EXPOSE Command?

Reading the docker documentation at https://docs.docker.com/engine/reference/builder/#expose the expose command syntax is described as:

EXPOSE <port> [<port>/<protocol>...]

To me, this indicates that I can use it like:

EXPOSE 8080
EXPOSE 8080 8081/tcp 8082/udp

but not

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

EXPOSE 8080/tcp

The examples they give contradict this:

EXPOSE 80/udp

and to expose the same port on different protocols they suggest using two lines:

EXPOSE 80/tcp
EXPOSE 80/udp

What does the syntax description actually mean?
Does EXPOSE 8080 8081 expose two ports?
Is EXPOSE 80/tcp 80/udp illegal?

>Solution :

The syntax is actually something like

"EXPOSE ", { p };

where

p = port, [ "/", proto ], " ";

(in EBNF)

Does EXPOSE 8080 8081 expose two ports?

Yes

Is EXPOSE 80/tcp 80/udp illegal?

No

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading