1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Docker コンテナが起動しない マウント系のエラー

Last updated at Posted at 2023-03-01

概要

  • docker-compose.yamlを自分でいじったあとdocker-compose upしたらマウント系のエラーが発生したので解決までの経緯をまとめる。

問題発生までの経緯

  • docker-compose.yamlのvolumesをいじった。

  • 下記コマンドを実行してコンテナを起動した。

    docker-compose up
    

問題

  • 下記のエラーが出てコンテナが起動しない。

    unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type'
    

問題解決までの経緯

  • 下記の記事を参考に確認したところvolumesで指定したファイルがホストPCに存在しなかった。

  • その代わりファイル名と同じディレクトリが作成されていた。
  • 参考文献にある通り、$ docker-compose upした際にvolumesがホストPCに無かった場合ディレクトリを自動で作ってくれるらしい。
  • 自動で作成されたディレクトリを削除した。
  • マウントするファイルを設置した。
  • $ docker-compose upを実行した。
  • 同じエラーがでて解消されない。
  • $ docker-compose downを実行してボリュームを削除した。
  • $ docker-compose upを実行した。
  • 問題は解決した。

参考文献

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?