LoginSignup
3
3

More than 5 years have passed since last update.

Dockerfile EXPOSEではポートの公開は行われない

Posted at

Dockerfileの記述の一つにEXPOSEがあります。

引数としてポートを指定するようになっているので、「外部にポートを公開するためにこれを書く」と説明する人が多いのですが、公式ドキュメントを見てみると

The EXPOSE instruction does not actually publish the port. It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published.

つまり、EXPOSEはあくまでイメージを作った人が意図している「外部に公開すべきポートを指定する」のであって、このコマンドによって実際に何か動作が変わるわけではないようです。何か公開したいポートがあるのならば、ドキュメントとして当然書いたほうがいいことに変わりはありません。

3
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3