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

docker-compose 覚え書き

Last updated at Posted at 2020-01-20

覚え書き

スケールを増やして起動する方法

docker-compose up -d —scale [service=scale_num]

上記コマンドでスケールを増やしてコンテナ起動ができます。
version: ‘3’以降
container_nameは使用できないので注意。
他のコンテナとhost名で解決している場合は

docker-compose -p [project_name] up -d —scale [service=scale_num]

project_nameを指定してあげると
[project_name]_[service_name]_[scale_num]で立ち上がる

docker-compose.yml
version: '3.7'
services:
  app:
    image: image_name
$ docker-compose -p exampleproject up -d --scale app=2

##################
# exampleproject_app_1
# exampleproject_app_2
# が立ち上がる

注意

  • プロジェクト名に_を使用しても_は自動的に消えてしまう
    example_project → exampleproject
  • docker-compose downではコンテナは削除されないが-p [project_name]を指定するとdownされる
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?