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 1 year has passed since last update.

Dockerコマンド

Last updated at Posted at 2023-08-08

バックグラウンドで起動

docker compose up -d                  

起動確認

docker-compose ps     

statusがUPになっていればOK

Docker一覧を確認

docker ps

Dockerに入る

 docker exec -it ドッカーのID bash

停止

データベースまで消える
docker-compose down
データベースは消えない
docker-compose stop

再起動

docker restart コンテナID  

デバッグ

docker-compose.ymlに以下2行を記載してその後build

docker-compose.yml
  web:
    build: .
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    ーーーここからーーー
    stdin_open: true
    tty: true
    ーーーここまでーーー

バックグラウンドで起動

docker compose up -d

Railsが動いているコンテナのIDを確認

docker ps

アタッチモード起動

docker attach CONTAINER_ID

停止

Ctrl+PかCtrl+Q
exit

ドッカーの外からコマンドを実行したい場合

$ docker exec CONTAINER-NAME COMMAND
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?