moby: rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: cannot exec a container that has run and stopped\n"

I see similar issues with previous versions of Docker, which have been marked Closed. I believe this issue is still present in latest Docker release 1.12.5.

I am running the latest release of Docker on a series of Vagrant VirtualBox VMs:

[vagrant@host3 ~]$ docker version
Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:23:59 2016
 OS/Arch:      linux/amd64

Server:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:23:59 2016
 OS/Arch:      linux/amd64

Attempting to run a docker exec on several running container, throws the same error. For example:

[vagrant@host3 ~]$ docker exec -it b17a8574bb5b /bin/bash
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: cannot exec a container that has run and stopped\n"

The container(s) are running:

[vagrant@host3 ~]$ docker ps
CONTAINER ID        IMAGE                                          COMMAND                  CREATED             STATUS              PORTS               NAMES
4c5cff3cc868        grafana/grafana:3.0.1                          "/.r/r /run.sh"          35 minutes ago      Up 35 minutes                           r-Prometheus-grafana-1-d0ce0f91
09fd975ee0ca        infinityworks/graf-db:09                       "cat"                    37 minutes ago      Up 37 minutes                           r-Prometheus-grafana-graf-db-1-7bd57453
59779e74cd78        infinityworks/prometheus-rancher-exporter:10   "/.r/r /bin/rancher_e"   40 minutes ago      Up 40 minutes                           r-Prometheus-prometheus-rancher-exporter-1-601148d6
986670c092a3        google/cadvisor:latest                         "/.r/r /usr/bin/cadvi"   48 minutes ago      Up 48 minutes                           r-Prometheus-cadvisor-3-a34c7ef7
34144c8e5f5e        prom/node-exporter:latest                      "/.r/r /bin/node_expo"   48 minutes ago      Up 48 minutes                           r-Prometheus-node-exporter-3-30c77bd7
82fe72052ce7        mongo:latest                                   "/.r/r /entrypoint.sh"   About an hour ago   Up About an hour                        r-voter-mongodb-1-1271f3d0
b17a8574bb5b        garystafford/voter-service:latest              "/.r/r java -jar vote"   About an hour ago   Up About an hour                        r-voter-voter-1-f1971cc1

More info:

[vagrant@host3 ~]$ docker info
Containers: 22
 Running: 20
 Paused: 0
 Stopped: 2
Images: 21
Server Version: 1.12.5
Storage Driver: devicemapper
 Pool Name: docker-253:0-25952534-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: 4.073 GB
 Data Space Total: 107.4 GB
 Data Space Available: 231 MB
 Metadata Space Used: 8.413 MB
 Metadata Space Total: 2.147 GB
 Metadata Space Available: 231 MB
 Thin Pool Minimum Free Space: 10.74 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. Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.135-RHEL7 (2016-09-28)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
 Volume: local
 Network: null host bridge overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: seccomp
Kernel Version: 3.10.0-327.36.1.el7.x86_64
Operating System: Red Hat Enterprise Linux
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 993 MiB
Name: host3
ID: 2P3F:NVGZ:YDOO:I2DI:MVNB:BFZN:ANWF:XJQR:RUN5:FJUB:3SZC:R32I
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Insecure Registries:
 127.0.0.0/8

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 12
  • Comments: 85 (30 by maintainers)

Most upvoted comments

@at-daonguyen looks like that’s not a bug; Are you running the alpine version of HAProxy? If so, you’re trying to start bash in a container that doesn’t have bash installed. Try using sh instead or bash

YES 👍 Can confirm that the official packages work! Just tried it at 3 severs. Somewhere at the update of the centos docker-1.12.5-14.el7.centos.x86_64 & docker-1.12.6-11.el7.centos.x86_64 things stop working.

Thank you all for the help! And very sorry for your time!

Can this issue please be closed? It looks like this was caused by a kernel module that was intentionally breaking container features. If anyone hits an issue with a similar-looking error please submit a new issue (after reading the error message, obviously).

Looks like it is related to some distribution containers. For me, it works for Alpine (latest) and Debian (latest), but not for Ubuntu (latest) and Centos (latest):

$ docker run -tid --hostname ubuntu1 ubuntu
67d4ab62a55be0274cf3590e359210309cab81e987a0f323fb1cc2ffb3de8b0c

$ docker run -tid --hostname centos1 centos
0e2f93769bd815399ffbadfa93761b131f79074a4da119cbc6d00d44413d6904

$ docker run -tid --hostname alpine1 alpine
d97217fe4b3bd4046c1adb89e064275be6262fb009103a7c9e7150d1a7942d13

$ docker run -tid --hostname debian1 debian
58167834ceee185827d16134294edc177e292ea77b18383ec418efd152570576

===> Ubuntu

$ docker exec 67d4ab62a55be ip a
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"ip\": executable file not found in $PATH"

===> Centos

$ docker exec 0e2f93769bd81 ip a
rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "exec: \"ip\": executable file not found in $PATH"

===> Alpine

$ docker exec d97217fe4b3bd4 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
137: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP 
    link/ether 02:42:ac:11:00:0a brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.10/16 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe11:a/64 scope link 
       valid_lft forever preferred_lft forever

===> Debian

$ docker exec 58167834ceee18 ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
139: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default 
    link/ether 02:42:ac:11:00:0b brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.11/16 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::42:acff:fe11:b/64 scope link 
       valid_lft forever preferred_lft forever

$ docker-runc --version
runc version 1.0.0-rc2
commit: 2f7393a47307a16f8cee44a37b262e8b81021e3e
spec: 1.0.0-rc2-dev
$ docker-runc --version
runc version 1.0.0-rc2
commit: 2f7393a47307a16f8cee44a37b262e8b81021e3e
spec: 1.0.0-rc2-dev
$ docker --version
Docker version 1.13.0, build 49bf474
$ docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:44:08 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:44:08 2017
 OS/Arch:      linux/amd64
 Experimental: false
$ uname -a
Linux gns3-iouvm 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u2 (2017-06-26) x86_64 GNU/Linux

$ sudo docker-runc list
ID                                                                 PID         STATUS      BUNDLE                                                                                       CREATED
065d100d80a6c75c67ecd9a92e6cb250f7a650008e05500ab23a2525d408e14c   4620        running     /run/docker/libcontainerd/065d100d80a6c75c67ecd9a92e6cb250f7a650008e05500ab23a2525d408e14c   2017-08-22T12:10:36.293436185Z
2dc23d689b7bff01af732c71c26ad83030eea7edf28af05f410b0b3932c95c02   4943        running     /run/docker/libcontainerd/2dc23d689b7bff01af732c71c26ad83030eea7edf28af05f410b0b3932c95c02   2017-08-22T12:10:48.883381866Z
8745b81170633e077dd933967f1083111edae9ef3d08dd31db6f2805221c4f44   26289       running     /run/docker/libcontainerd/8745b81170633e077dd933967f1083111edae9ef3d08dd31db6f2805221c4f44   2017-08-22T13:33:21.971188726Z
8ac59a60a84e0b47f701723f29537919c830d39b13036a70a39e796a690f6127   26159       running     /run/docker/libcontainerd/8ac59a60a84e0b47f701723f29537919c830d39b13036a70a39e796a690f6127   2017-08-22T13:33:14.962479906Z
924d2c6fcc8c9848a59819cbdc5889680e0f4cf1fa5c2b1948160e59e266d37f   5077        running     /run/docker/libcontainerd/924d2c6fcc8c9848a59819cbdc5889680e0f4cf1fa5c2b1948160e59e266d37f   2017-08-22T12:10:56.093542345Z
a1d800f4f2799a55284346776102f81595c3b1322e467d34e5aba262aae77668   4757        running     /run/docker/libcontainerd/a1d800f4f2799a55284346776102f81595c3b1322e467d34e5aba262aae77668   2017-08-22T12:10:43.143328545Z

$ docker info
Containers: 150
 Running: 6
 Paused: 0
 Stopped: 144
Images: 559
Server Version: 1.13.0
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 1118
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 03e5862ec0d8d3b3f750e19fca3ee367e13c090e
runc version: 2f7393a47307a16f8cee44a37b262e8b81021e3e
init version: 949e6fa
Kernel Version: 3.16.0-4-amd64
Operating System: Debian GNU/Linux 8 (jessie)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.67 GiB
Name: myhostname
ID: HNCH:7EGA:JAQV:R63E:WIQC:6CV7:YF5O:VA67:2QSJ:TRE3:P3Y7:OJQF
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: ajnouri
Registry: https://index.docker.io/v1/
WARNING: No memory limit support
WARNING: No swap limit support
WARNING: No kernel memory limit support
WARNING: No oom kill disable support
WARNING: No cpu cfs quota support
WARNING: No cpu cfs period support
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

I had the same issue, the solution removed all docker containers with docker rm $(docker ps -a -q)

docker-runc, not docker -runc. docker-runc is Docker’s packaged version of runC.

Yes, Ubuntu 16.04.2 LTS Yes, docker-ce: Docker version 17.03.0-ce, build 3a232c8

Well, here even systemctl stop docker rm -fr /var/lib/docker/* systemctl start docker did not help 😦

I have similar issues with docker exec -it <image-name> bash when setting up the starter kit of hyperledger fabric project. The error is reproducible with a simpler setup, e.g.

Run bash in a docker container “ubuntu” and want to exec this running container from another terminal.

$ docker images REPOSITORY TAG IMAGE ID CREATED SIZEubuntu latest 104bec311bcd 2 weeks ago 129 MB ...

run in terminal 1 $ docker run --rm --name test1 -it ubuntu bash root@f454c9a79ed4:/#

check status with docker ps $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES f454c9a79ed4 ubuntu "bash" 21 seconds ago Up 19 seconds test1

try to exec another bash command in second terminal $ docker exec -it test1 bash rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"process_linux.go:83: executing setns process caused \\\"exit status 17\\\"\"\n"