moby: ERROR: Container command not found or does not exist.
Summary: On Windows: when something goes wrong like a missing file or similar, the output of docker’s error can be more explanatory.
Output of docker version
:
$ docker version
Client:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 22:37:33 2016
OS/Arch: windows/amd64
Server:
Version: 1.10.2
API version: 1.22
Go version: go1.5.3
Git commit: c3959b1
Built: Mon Feb 22 22:37:33 2016
OS/Arch: linux/amd64
Output of docker info
:
Containers: 12
Running: 6
Paused: 0
Stopped: 6
Images: 42
Server Version: 1.10.2
Storage Driver: aufs
Root Dir: /mnt/sda1/var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 170
Dirperm1 Supported: true
Execution Driver: native-0.2
Logging Driver: json-file
Plugins:
Volume: local
Network: host bridge null
Kernel Version: 4.1.18-boot2docker
Operating System: Boot2Docker 1.10.2 (TCL 6.4.1); master : 611be10 - Mon Feb 22 22:47:06 UTC 2016
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 996.1 MiB
Name: default
ID: AMDN:EJZ3:24NZ:6PET:A3ZB:SRAR:MKLG:IYP2:CWAC:PIXJ:YFKL:ZJYW
Debug mode (server): true
File Descriptors: 52
Goroutines: 70
System Time: 2016-02-29T16:46:15.919696262Z
EventsListeners: 0
Init SHA1:
Init Path: /usr/local/bin/docker
Docker Root Dir: /mnt/sda1/var/lib/docker
Labels:
provider=virtualbox
Provide additional environment details (AWS, VirtualBox, physical, etc.): Virtualbox
List the steps to reproduce the issue:
- Docker run image
Describe the results you received: Getting the error: ERROR: Container command not found or does not exist.
Describe the results you expected: Expected the image to run
Provide additional info you think is important: Related to this link - https://github.com/docker/compose/issues/2950
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 47 (16 by maintainers)
Not sure if this helps anyone, but I recently ran into this issue after upgrading Docker to 1.11.2, build b9f10c9. I had failed to restart the daemon after the update. Fortunately, restarting Docker was all that was required.
More on the same issue, I just spend a nice amount of time debugging the
"Container command not found or does not exist."
error message. It turned my entrypoint file contained windows line-endings.The problem is that the error message supplied by docker isn’t informative enough in this case. The original error inside the container looked like this and is just a crucial bit more helpful:
bash: /docker-entrypoint.sh: /bin/bash^M: bad interpreter: No such file or directory
Before seeing this it took me lots of debugging to verify that the file was a: present b: executable c: not containing any errors (except for those freaking line endings) d: and even more time to figure out that I has to test the file inside the container as an executable and not using a “sh” prefix.
Solution 1 In my case raising the original error is an option or would that lead to confusing output in other usecases? How often does this error occur? Maybe it is an option to run a few helpful checks for common causes:
One way to help debug the issue is to run
docker-machine ssh [machine-name]
andtail -f /var/log/docker.log
while you are starting the container. Here is the output I saw for this error:time=“2016-02-29T17:51:30.464189301Z” level=debug msg=“ReleaseAddress(LocalDefault/172.17.0.0/16, 172.17.0.9)” time=“2016-02-29T17:51:30.470394694Z” level=error msg=“error locating sandbox id 232155e69307b7dd9a5c2e5408d3fcd9d6ed4b3d6eaedd884891262ab83eb39c: sandbox 232155e69307b7dd9a5c2e5408d3fcd9d6ed4b3d6eaedd884891262ab83eb39c not found” time=“2016-02-29T17:51:30.470439375Z” level=warning msg=“failed to cleanup ipc mounts:\nfailed to umount /mnt/sda1/var/lib/docker/containers/847abf893e4e5c1cad35f5104784e258fecd4d4d6d10cc462ed6403c6b096b32/shm: invalid argument” time=“2016-02-29T17:51:30.470453358Z” level=error msg=“Error unmounting container 847abf893e4e5c1cad35f5104784e258fecd4d4d6d10cc462ed6403c6b096b32: not mounted” time=“2016-02-29T17:51:30.470516269Z” level=error msg=“Handler for POST /v1.21/containers/847abf893e4e5c1cad35f5104784e258fecd4d4d6d10cc462ed6403c6b096b32/start returned error: Container command not found or does not exist.”
On AWS EC2/ubuntu, I tried to transform a Dockerfile setup from
phusion/baseimage
togliderslabs/alpine
. Turns out that those shell scripts usebash
– of course! Simply change tosh
, as bash is not present, resulting in the above error…I think it would be descriptive enough if we would print the
cmd
that could not be run with proper error message, so that its easier to trace down the exact issue. e.g. cannot start container: commandcmd
was not found or does not existContainer command not found
seems to be ambiguous one.For that matter, I think it would be good if this could also be modified to show proper error, like
cannot start container, command 'cmd' could not be invoked: permission denied
https://github.com/docker/docker/blob/v1.10.2/errors/daemon.go#L952-L959I have the same problem.
+1 The same issue on Mac OS X
Turns out my issue was the volumes section was not mounting properly because on the windows version only the C:\Users directory gets mounted. Moving the project into that directory solved the issue. There were also a few executable +x issues on two files and some files had Windows style carriage returns at the end of the line that needed to be converted. Still would be nice to know which command cannot be found.
+1
@Nathre2501 yes: the container does not have access to anything on your host, so if software is not present inside the container, then you won’t be able to run it.
So, unless PyCharm is doing some tricks to either automatically install it, or (e.g.) bind-mount a static binary in the container, you won’t be able to run python inside there.
You can either install python, or use a python base image (which may be a better approach); https://hub.docker.com/_/python/
In case anyone else hits this error message, like I did, after upgrading ubuntu to 16.04, the cause of the error for me was apparmor. The appropriate solution would be to update the apparmor profile for docker so things work properly. For me, on my personal server, I just disabled and deleted apparmor.