Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oci runtime error #232

Closed
stiplady opened this issue Mar 26, 2019 · 9 comments
Closed

oci runtime error #232

stiplady opened this issue Mar 26, 2019 · 9 comments

Comments

@stiplady
Copy link

How can I fix this, Google isn't being much help...

First time installing openhab with a fresh docker installation.

# docker-compose up
Recreating openhab2_openhab_1 ... error

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


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

ERROR: Encountered errors while bringing up the project.

Using docker-compose.yml

version: '2.2'

services:
  openhab:
    image: "openhab/openhab:2.4.0"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "./openhab_addons:/openhab/addons"
      - "./openhab_conf:/openhab/conf"
      - "./openhab_userdata:/openhab/userdata"
    environment:
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"

System information

# docker --version
Docker version 1.13.1, build b2f74b2/1.13.1

# docker-compose --version
docker-compose version 1.23.2, build 1110ad01

# cat /etc/*-release
CentOS Linux release 7.6.1810 (Core) 
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"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.6.1810 (Core) 
CentOS Linux release 7.6.1810 (Core) 
@wborn
Copy link
Member

wborn commented Mar 27, 2019

Since it's CentOS, which is very security hardened by default, it might be a permissions issue. Does it work if you use setenforce 0? Maybe journalctl shows you what permissions are missing.

@stiplady
Copy link
Author

journalctl -u docker.service shows this as the most recent entries after trying to start the container.

Mar 26 23:56:48 zoostorm-1 dockerd-current[14383]: [2019-03-26T23:56:48,433][WARN ][o.e.d.c.m.MetaDataCreateIndexService] [ZNMrnc8] the default number of shards will change from [5]
Mar 26 23:56:48 zoostorm-1 dockerd-current[14383]: [2019-03-26T23:56:48,526][INFO ][o.e.c.m.MetaDataCreateIndexService] [ZNMrnc8] [customer] creating index, cause [api], templates [
Mar 26 23:56:52 zoostorm-1 dockerd-current[14383]: [2019-03-26T23:56:52,583][INFO ][o.e.c.r.a.AllocationService] [ZNMrnc8] Cluster health status changed from [YELLOW] to [GREEN] (re
Mar 27 21:51:57 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:51:56.998759364Z" level=error msg="Handler for POST /v1.25/containers/c6310f9211a6cf22b0a389518d06b8704df1c558
Mar 27 21:51:57 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:51:57.410431177Z" level=error msg="Handler for POST /v1.25/containers/29f08aee4e7ce90217e206bc5713db18726d1343
Mar 27 21:51:57 zoostorm-1 dockerd-current[14383]: container_linux.go:247: starting container process caused "container init exited prematurely"
Mar 27 21:51:57 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:51:57.894673763Z" level=error msg="containerd: start container" error="oci runtime error: container_linux.go:2
Mar 27 21:51:57 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:51:57.895523237Z" level=error msg="Create container failed with error: oci runtime error: container_linux.go:2
Mar 27 21:51:58 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:51:58.075229475Z" level=warning msg="4c960d0b8c8af4132f3355b7b3351f5c7c8d809b4e0f680613fdf11de3b5470d cleanup:
Mar 27 21:51:58 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:51:58.075290605Z" level=error msg="Handler for POST /v1.25/containers/4c960d0b8c8af4132f3355b7b3351f5c7c8d809b

After issuing the setenforce command these are the entries from journalctl

Mar 27 21:57:54 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:57:54.746131335Z" level=error msg="Handler for POST /v1.25/containers/4c960d0b8c8af4132f3355b7b3351f5c7c8d809b
Mar 27 21:57:54 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:57:54.832738971Z" level=error msg="Handler for POST /v1.25/containers/29f08aee4e7ce90217e206bc5713db18726d1343
Mar 27 21:57:55 zoostorm-1 oci-systemd-hook[7150]: systemdhook <debug>: 4a079ff5030f: Skipping as container command is /entrypoint.sh, not init or systemd
Mar 27 21:57:55 zoostorm-1 dockerd-current[14383]: container_linux.go:247: starting container process caused "container init exited prematurely"
Mar 27 21:57:55 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:57:55.322137665Z" level=error msg="containerd: start container" error="oci runtime error: container_linux.go:2
Mar 27 21:57:55 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:57:55.323086810Z" level=error msg="Create container failed with error: oci runtime error: container_linux.go:2
Mar 27 21:57:55 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:57:55.498247729Z" level=warning msg="4a079ff5030f541cd60a6bfd83e5640541e60369f77ec254adf6c4899fc8f77e cleanup:
Mar 27 21:57:55 zoostorm-1 dockerd-current[14383]: time="2019-03-27T21:57:55.498305937Z" level=error msg="Handler for POST /v1.25/containers/4a079ff5030f541cd60a6bfd83e5640541e60369

@wborn
Copy link
Member

wborn commented Mar 27, 2019

With SELinux you'll also need to mount writable volumes with :z or :Z (see selinux label) eg.:

      - "./openhab_addons:/openhab/addons:z"
      - "./openhab_conf:/openhab/conf:z"
      - "./openhab_userdata:/openhab/userdata:z"

@stiplady
Copy link
Author

Updated docker-compose.yml to this

version: '2.2'

services:
  openhab:
    image: "openhab/openhab:2.4.0"
    restart: always
    network_mode: host
    volumes:
      - "/etc/localtime:/etc/localtime:ro"
      - "/etc/timezone:/etc/timezone:ro"
      - "./openhab_addons:/openhab/addons:z"
      - "./openhab_conf:/openhab/conf:z"
      - "./openhab_userdata:/openhab/userdata:z"
    environment:
      OPENHAB_HTTP_PORT: "8080"
      OPENHAB_HTTPS_PORT: "8443"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"

Still won't load, same log entries, attached below (without truncated line content)

Mar 27 22:48:03 zoostorm-1 dockerd-current[14383]: time="2019-03-27T22:48:03.288338955Z" level=error msg="Handler for POST /v1.25/containers/4a079ff5030f541cd60a6bfd83e5640541e60369f77ec254adf6c4899fc8f77e/stop returned error: Container 4a079ff5030f541cd60a6bfd83e5640541e60369f77ec254adf6c4899fc8f77e is already stopped"
Mar 27 22:48:03 zoostorm-1 dockerd-current[14383]: time="2019-03-27T22:48:03.747109673Z" level=error msg="Handler for POST /v1.25/containers/29f08aee4e7ce90217e206bc5713db18726d13431858651c23042dbecb410516/stop returned error: Container 29f08aee4e7ce90217e206bc5713db18726d13431858651c23042dbecb410516 is already stopped"
Mar 27 22:48:04 zoostorm-1 oci-systemd-hook[9673]: systemdhook <debug>: 820b2e1a4f84: Skipping as container command is /entrypoint.sh, not init or systemd
Mar 27 22:48:04 zoostorm-1 dockerd-current[14383]: container_linux.go:247: starting container process caused "container init exited prematurely"
Mar 27 22:48:04 zoostorm-1 dockerd-current[14383]: time="2019-03-27T22:48:04.263417296Z" level=error msg="containerd: start container" error="oci runtime error: container_linux.go:247: starting container process caused \"container init exited prematurely\"\n" id=820b2e1a4f84ae60adfcc14599c69b09dd2ab46026c3262ab55ddbcf582b7220
Mar 27 22:48:04 zoostorm-1 dockerd-current[14383]: time="2019-03-27T22:48:04.264631044Z" level=error msg="Create container failed with error: oci runtime error: container_linux.go:247: starting container process caused \"container init exited prematurely\"\n"
Mar 27 22:48:04 zoostorm-1 dockerd-current[14383]: time="2019-03-27T22:48:04.821320995Z" level=warning msg="820b2e1a4f84ae60adfcc14599c69b09dd2ab46026c3262ab55ddbcf582b7220 cleanup: failed to unmount secrets: invalid argument"
Mar 27 22:48:04 zoostorm-1 dockerd-current[14383]: time="2019-03-27T22:48:04.821381731Z" level=error msg="Handler for POST /v1.25/containers/820b2e1a4f84ae60adfcc14599c69b09dd2ab46026c3262ab55ddbcf582b7220/start returned error: oci runtime error: container_linux.go:247: starting container process caused \"container init exited prematurely\"\n"

@stiplady
Copy link
Author

Removing the openhab_* volumes from the yml doesn't help either.

@stiplady
Copy link
Author

disabling SELinux (/etc/selinux/config) and rebooting, confirming with getenforce and attempting to start also has the same problems, so I don't believe this to be a permissions issue.

@grimlokason
Copy link

grimlokason commented Apr 12, 2019

Hello,

Just encoutered the same kind of error on RHEL7 after upgrading the docker engine.
Try to remove your :
- "/etc/localtime:/etc/localtime:ro"
- "/etc/timezone:/etc/timezone:ro"

Edit :
Your /etc/localtime must be a link ( mine was pointing to : /usr/share/zoneinfo/Europe/Paris )
so i changed copy /usr/share/zoneinfo/Europe/Paris over /etc/localtime on the host ( yep, it's dirty...)
It worked.
So in the docker-compose.yml , I changed from "/etc/localtime:/etc/localtime:ro" to "/usr/share/zoneinfo/Europe/Paris:/etc/localtime:ro" : it crashed.

I moved to a possible better way to do it ( when possible ), adding "TZ=Europe/Paris" in environment.

You can find more information in "solution 2" here : https://medium.com/@ibrahimgunduz34/be-careful-while-playing-docker-about-timezone-configuration-e7a2217e9b76

@wborn
Copy link
Member

wborn commented Apr 14, 2019

That makes sense indeed @grimlokason!
I ran into the same issue on CentOS one day. 😉
Does it also resolve your issue @stiplady?

@stiplady
Copy link
Author

Perfect, thanks. I was away, but yes this has done the trick, all working fine now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants