0
1

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

Docker Composeでサービス名を抽出して実行する

Posted at

前提

docker-compose.yaml
version: "3.3"
services:
  serviceA:
  
  taskA:

  taskB:

本題

docker-compose psを使えばserviceの名称を取得できます。

$ docker-compose ps --service
serviceA
taskA
taskB

taskだけ実行する

$ docker-compose ps --service | grep task | xargs -I % docker-compose run %
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?