Boot2docker / Windows: cannot start bash in Ubuntu container

I am working on the Docker Book, in Chapter 3, I install and run the Ubuntu container. I am on Windows 7.1 using Boot2Docker.

This is what happens when I try to run it (this is the second attempt, so it already has a local copy of the image):

$ docker run -i -t ubuntu /bin/bash exec: "C:/Program Files (x86)/Git/bin/bash": stat C:/Program Files (x86)/Git/bin/bash: no such file or directory FATA[0000] Error response from daemon: Cannot start container 5e985b0b101bb9584ea3e40355089a54d1fba29655d5a1e0900c9b32c4f7e4c4: [8] System error: exec: "C:/Program Files (x86)/Git/bin/bash": stat C:/Program Files (x86)/Git/bin/bash: no such file or directory 

Status:

 $ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 5e985b0b101b ubuntu:latest "C:/Program Files (x 21 minutes ago loving_mayer 

He complains about the lack of C: / Program Files (x86) / Git / bin / bash, but of course this is on my machine:

 $ ls -l "c:/Program Files (x86)/Git/bin/bash" -rwxr-xr-x 1 neilw Administ 598016 May 4 09:27 c:/Program Files (x86)/Git/bin/bash 

Any thoughts?

+6
source share
3 answers

This works for me:

 docker run -t -i ubuntu //bin/bash 

Double // avoids conversion [1]

[1] http://www.mingw.org/wiki/Posix_path_conversion

+23
source

I had the same problem but

 docker run -t -i ubuntu 

opens a shell inside the image.

+2
source

It looks like your host shell automatically extends /bin/bash to C:/Program Files (x86)/Git/bin/bash before it is transferred to Docker, which is incorrect, since it is obvious that there is no C:/Program Files (x86)/Git/bin/bash inside the Ubuntu container C:/Program Files (x86)/Git/bin/bash .

Is using quotation marks a problem? For instance:

 docker run -i -t ubuntu "/bin/bash" 
0
source

Source: https://habr.com/ru/post/986843/


All Articles