1
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 3 years have passed since last update.

Dockerコンテナにラベルを設定する

Posted at

■labelsを設定

docker-compose.yml
version: '3.7'
services:
  app:
    container_name: app
    labels:
      - test.container.type=web

例えば、コンテナにtest.container.typeというキーでwebという値を設定します。

設定すると何が出来るのか?

設定するとdocker psにフィルターをかけることも可能になります。

■起動中のコンテナ一覧から抽出を行う

docker ps -f 'label=test.container.type=web'

上記でtest.container.typeというキーでwebが設定されているコンテナのみの一覧が表示されます。

1
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
1
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?