Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does docker EXPOSE refer to the container port or the host port?

The Dockerfile command EXPOSE and the docker run argument --expose tells docker that the port must be exposed.

When publishing ports with -p, you can map an outer host port to a different inner container port, e.g. docker run -p 8080:80, where 8080 is the host port and 80 is the container port.

My question is, does EXPOSE refer to the inner container port or the outer host port?

like image 363
cowlinator Avatar asked Jan 28 '19 22:01

cowlinator


1 Answers

The EXPOSE instruction in a Dockerfile refers to the container port.

like image 148
King Chung Huang Avatar answered Oct 12 '22 10:10

King Chung Huang