回答編集履歴
2
メリットの追加
answer
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
exposeは必要ありません。
|
2
|
-
公式のリファレンスにかかれている通りです。
|
2
|
+
公式のリファレンスにかかれている通りです。ただし、このドキュメントにもあるように、明示することでメリットもあるため、使う人は多いと思います。
|
3
3
|
|
4
4
|
[https://docs.docker.com/engine/reference/builder/#expose
|
5
5
|
](https://docs.docker.com/engine/reference/builder/#expose)
|
1
リンク修正
answer
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
exposeは必要ありません。
|
2
2
|
公式のリファレンスにかかれている通りです。
|
3
3
|
|
4
|
-
https://docs.docker.com/engine/reference/builder/#
|
4
|
+
[https://docs.docker.com/engine/reference/builder/#expose
|
5
|
-
|
5
|
+
](https://docs.docker.com/engine/reference/builder/#expose)
|
6
6
|
> 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. To actually publish the port when running the container, use the -p flag on docker run to publish and map one or more ports, or the -P flag to publish all exposed ports and map them to high-order ports.
|
7
7
|
|
8
8
|
EXPOSEは実際にはPortを公開しません。これは、イメージを作った人がどのポートで動くことを期待しているかを明示するための一種のドキュメントとして作用します。実際にポートを公開するには、docker runしてコンテナを動かす際に-pオプションを付与します。
|