Compose: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"

Created on 21 Jan 2020  路  5Comments  路  Source: docker/compose

Description of the issue

When I tried to setup and launch Kibana with docker-compose, I had the following error:

ERROR: for kibana Cannot start service kibana: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"

This configuration is directly coming from the vendor:
https://www.elastic.co/guide/en/kibana/current/docker.html

And I also noticed that in another VM (Based on Centos7), I ran the same configuration, and everything worked without that error... Stange here.

I also noticed during my researches that many projects that use docker-compose encountered the same issue, and not specificaly for Kibana, which let me think that docker-compose has an issue.

Somehow the answer from @sybrandy in another project for the same issue let me think that the volume would be the issue behind, so I commented the volumes section as follow:

kibana:
    image: docker.elastic.co/kibana/kibana:7.5.1
    container_name: kibana
    #volumes:
    #  - ./kibana.yml:/usr/share/kibana/config/kibana.yml
    ports:
      - "5602:5602"
    networks:
      - elastic

And the error disappeared.

Context information (for bug reports)

Output of docker-compose version

docker-compose version 1.25.0, build 0a186604
docker-py version: 4.1.0
CPython version: 3.7.4
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Output of docker version

Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7f2769b/1.13.1
 Built:           Sun Sep 15 14:06:47 2019
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-103.git7f2769b.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7f2769b/1.13.1
 Built:           Sun Sep 15 14:06:47 2019
 OS/Arch:         linux/amd64
 Experimental:    false

Output of docker-compose config
(Make sure to add the relevant -f and other flags)

networks:
  elastic:
    driver: bridge
services:
  kibana:
    image: docker.elastic.co/kibana/kibana:7.5.1
    networks:
      elastic: null
    ports:
    - published: 5611
      target: 5656
version: '3.7'

Steps to reproduce the issue

  1. Create docker-compose.yml file as described in:
    https://www.elastic.co/guide/en/kibana/current/docker.html
  2. Use of physical server based on the following characteristics:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
Architecture: x86_64
CPU: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz

  1. Launch the file with docker-compose up and wait for the error.

Observed result

[admin@pc-6 collect]$ docker-compose up
Recreating collect_kibana_1 ... error

ERROR: for collect_kibana_1  Cannot start service kibana: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"


ERROR: for kibana  Cannot start service kibana: oci runtime error: container_linux.go:235: starting container process caused "container init exited prematurely"

Expected result

When the volumes section is commented, everything works:

[admin@pc-6 collect]$ docker-compose up
Removing collect_kibana_1  
Recreating 837eb4c8790c_collect_kibana_1 ... done
Attaching to collect_kibana_1  
kinbug

Most helpful comment

I got same issue with kibana with similar settings you @toshiro92. My issue was I used volume path incorrectly and doing a volumes: - ./kibana.yml:/usr/share/kibana/config/kibana.yml, /usr/share/kibana/config/kibana.yml was a dir rather than a .yml file, silly though but a correct volume path fixed my issue.

All 5 comments

facing the exact same behaviour on rhel7

We also faced the issue on rhel7 and this should log some proper error about the volumes. Very missleading

got slite different Error: "oci runtime error: container_linux.go:235: starting container process caused exec bin/sh state:/bin/sh no such file or directory"

i was trying run CMD command in Dockerfile
eg. CMD ["/opt/xxxx/xxx/start.sh"] or CMD ["/bin/sh","-c","/opt/xxxx/xxx/start.sh"]
even this file has executable permission like- chmod 777 /opt/xxxx/xxx/start.sh

I got same issue with kibana with similar settings you @toshiro92. My issue was I used volume path incorrectly and doing a volumes: - ./kibana.yml:/usr/share/kibana/config/kibana.yml, /usr/share/kibana/config/kibana.yml was a dir rather than a .yml file, silly though but a correct volume path fixed my issue.

We also encountered this error with a volumes section like:

volumes:
  ./CA.crt:/etc/ssl/certs:ro

We fixed this by replacing it with:

volumes:
  ./CA.crt:/etc/ssl/certs/CA.crt:ro

This was on docker-compose 1.22.0, docker-py 3.5.0, docker 1.13.1.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dazorni picture dazorni  路  3Comments

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  3Comments

bergtwvd picture bergtwvd  路  3Comments

maltefiala picture maltefiala  路  3Comments

dimsav picture dimsav  路  3Comments