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:

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

Most upvoted comments

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:

  • Does the entrypoint exist?
  • Is it executable?
  • Does it contain Windows line-endings

One way to help debug the issue is to run docker-machine ssh [machine-name] and tail -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 to gliderslabs/alpine. Turns out that those shell scripts use bash – of course! Simply change to sh, 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: command cmd was not found or does not exist

Container 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-L959

I 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

  • docker version
docker version
Client:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:23:11 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.11.2
 API version:  1.23
 Go version:   go1.5.4
 Git commit:   b9f10c9
 Built:        Wed Jun  1 21:23:11 2016
 OS/Arch:      linux/amd64
  • docker info
Containers: 38
 Running: 6
 Paused: 0
 Stopped: 32
Images: 53
Server Version: 1.11.2
Storage Driver: devicemapper
 Pool Name: docker-8:1-234881221-pool
 Pool Blocksize: 65.54 kB
 Base Device Size: 10.74 GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 32.89 GB
 Data Space Total: 107.4 GB
 Data Space Available: 68.8 GB
 Metadata Space Used: 43.63 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 2.104 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm$no_warn_on_loop_devices=true` to suppress this warning.
Metadata Space Available: 2.104 GB
 Udev Sync Supported: true
 Deferred Removal Enabled: false
 Deferred Deletion Enabled: false
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 WARNING: Usage of loopback devices is strongly discouraged for production use. Either use `--storage-opt dm.thinpooldev` or use `--storage-opt dm.no_warn_on_loop_devices=true` to suppress this warning.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.107-RHEL7 (2016-06-09)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge null host
Kernel Version: 3.10.0-327.18.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 14.69 GiB
Name: e5876c17-8860-48d8-9742-cfea5e952642.bigdata.sysadmin
ID: I7DX:J6UJ:5N3J:S5MV:XB2H:HPW7:Q3R3:RZTY:LR63:CK6A:H4UK:6SAX
Docker Root Dir: /var/lib/docker
Debug mode (client): false
Debug mode (server): false
Registry: https://index.docker.io/v1/
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
Labels:
 slave=true
 LINKER_MESOS_ATTRIBUTE=lb:enable
 provider=generic
Cluster store: zk://10.140.0.14:2181
Cluster advertise: 10.140.0.15:2376
  • error info when start cadvisor
sudo docker run \
>   --volume=/:/rootfs:ro \
>   --volume=/var/run:/var/run:rw \
>   --volume=/sys:/sys:ro \
>   --volume=/var/lib/docker/:/var/lib/docker:ro \
>   --publish=8080:8080 \
>   --detach=true \
>   --name=cadvisor \
>   google/cadvisor:latest
c698691a1995a208d238875a9e3b8a751634ba4a6633581b5a6fd25e02d4266e
docker: Error response from daemon: Container command '/usr/bin/cadvisor' not found or does not exist..

@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.