163
139

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 up したコンテナを起動させ続ける方法

Posted at

こんにちはsekitakaです。

ポート待受とかしていないコンテナをdocker-compose upで起動するとコンテナがすぐ終了してしまうと思います。
そんなときは以下のようにdocker-compose.ymlのttyをtrueに設定しておくと、コンテナが起動し続けます。

docker-compose.yml
version: '2'
services:
  mypy:
    image: python:latest
    tty: true

その後調査などでコンテナにbash起動が必要であれば、以下のようにして接続することができます。

docker exec -it <コンテナID_or_NAME> bash
163
139
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
163
139

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?