0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Docker】docker compose run でポートマッピングする方法

Posted at

--service-ports

--service-portsを使用することでcompose.ymlに記述したportsを適用することができます。

$ docker compose run --service-ports --rm service bash

$ docker container port container-name
3000/tcp -> 0.0.0.0:3000
6006/tcp -> 0.0.0.0:6006

--service-portsを使用しないとportsは無視されます。

$ docker compose run --rm service bash

$ docker container port container-name
# 何も出力されない
0
0
0

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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?