3
9

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 buildでエラー発生

Posted at

はじめに

$ docker-compose build
をすると以下のようなエラーが発生してしまう。

$docker-compose build mysql1 uses an image, skipping phpmyadmin1 uses an image, skipping Building web1 Step 1/11 : FROM php:7.2-apache

エラー内容でぐぐるもそれらしい情報が出てこなかった。
備忘録として書いておく

原因

docker-compose up -d
を実行すると次のようなエラーが出力されている
ERROR: for web Cannot create container for service web1: Conflict. The container name "/web" is already in use by container "53394296f8d037f3ddcc5f22483d893cce537958422dfa6071222aff77c5a547". You havCreating mysql ... error

どうやら既存のコンテナと重複しているようだ。その証拠にconflictが出力されている。

解決策

https://qiita.com/ozhaan/items/9e2090da22ffd6c7ad2a
のサイトに書いてある以下のコマンドを実行することで既存のコンテナを一括削除できる

$ docker rm $(docker ps -aq)
コマンド実行後に
$ docker-compose up -d
を実行すると
Creating mysql ... done Creating web ... done Creating phpmyadmin ... done
隣無事にコンテナを立ち上げることができた。

参考にしたサイト

3
9
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
3
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?