15
15

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 5 years have passed since last update.

Boot2Docker on WindowsでMinGWのパス変換を回避する

Last updated at Posted at 2015-08-09

WindowsのBoot2Dockerでdocker execのようなパスを渡すコマンドを実行すると以下のように失敗してしまいます。

$ docker exec -it 500e4b38e0fd /bin/bash
exec: "C:/Program Files (x86)/Git/bin/bash": stat C:/Program Files (x86)/Git/bin/bash: no such file or directory

これはMinGWのPosix path conversionによってパスがいい感じに変換されてしまうためです。
このルールとエラーメッセージから/bin/bashC:/Program Files (x86)/Git/bin/bashに変換されている事が分かります。
それではどうすればいいのかと言えば、パスの先頭の/を二重にすることで変換を抑制できます。

$ docker exec -it 500e4b38e0fd //bin/bash
root@500e4b38e0fd:/data#

MinGWのPosix path conversionはコマンドライン文字列のすべてに影響するので-fオプションなどでファイルのパスを指定する際も同様に対処が必要になります。

15
15
1

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?