LoginSignup
0
0

【docker compose】ログをすべて消すコマンド

Posted at

備忘録

動作確認環境

Windows11
WSL2(Ubuntu-22.04)
jq コマンドのインストールが必要(sudo apt -y install jq) ※適宜apt update

コマンド

ワンライナー

sudo sh -c 'for id in $(docker compose ps -q); do log_path=$(docker inspect $id | jq -r ".[0].LogPath"); echo "" > "$log_path"; done'

整形したもの

sudo sh -c '
  for id in $(docker compose ps -q); do
    log_path=$(docker inspect $id | jq -r ".[0].LogPath")
    echo "" > "$log_path"
  done
'

これでスッキリ

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