StackShelf
Dockerエラー エラー解決

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? の原因と解決法

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? の原因と具体的な解決手順をまとめました。

2分で読める
dockerDockerエラーCannot connect to the Docker daemon at unixDockerCannot connect to the Docker daemon at u

エラーメッセージ(全文)

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

このエラーとは

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? は Docker 開発でよく遭遇するエラーです。

想定環境: Windows / macOS / Linux

よく出る状況: docker run / build / compose 時

よくある原因

  • デーモン停止
  • ポート競合
  • Dockerfile ビルド失敗
  • ディスク不足

解決方法

方法1: デーモン確認

sudo systemctl status docker

sudo systemctl start docker

方法2: ポート変更

-p 8080:80 など別ポートにマッピング.

それでも直らないとき

バージョン情報(Docker のバージョン、OS、実行コマンド)を添えて、エラーメッセージ全文と直前に変更した点を確認してください。ログの数行上にも原因の手がかりが残っていることが多いです。

まとめ

「Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?」は デーモン停止 が原因のことが多いです。上記の手順で切り分けてください。

次にやること

同じ Docker カテゴリの関連エラーもあわせて確認してください。

よくある質問

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the do… とは何ですか?

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? は Docker 実行時に表示されるエラーです。デーモン停止

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the do… の原因は?

デーモン停止。ポート競合。Dockerfile ビルド失敗。

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the do… の直し方は?

デーモン確認:sudo systemctl status docker ポート変更:-p 8080:80 など別ポートにマッピング.

Docker で Cannot connect to the Docker daemon at unix が出るのはなぜ?

docker run / build / compose 時

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the do… を防ぐには?

次に読むべき記事

同カテゴリ「Dockerエラー」の記事

学習ルート

体系的に学びたい方はこちらから。

エラー・トラブル集で続きを探す →

あわせて読みたい