15
15

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-10-01
docker-compose up -d --no-deps --build <service_name>

--no-deps - 紐づいている他のサービスを起動しない

--build - コンテナを起動する前にビルドをする


version: "3.3"

services:
    app:
        container_name: "my-app"

<service_name>にはコンテナ名ではなく、docker-compose.ymlのサービス名を入れるのに注意。
上記の例だと、my-appではなく、appになります。

再ビルドして起動したいのは一つのコンテナだけなのに、つい毎回docker-compose down && docker-compose build && docker-compose up -d
してしまっていてもっと短い時間でできたらなぁと思い調べた内容でした。

参考

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?