Error: Unexpected preparation error: Internal Error - runner failed with exit code: 126

docker
circle.yml

#1

Hello,

I’ve been having problems when running a container specifying a command with an entrypoint defined in the image.
I have the following Dockerfile:

FROM ubuntu:16.04
COPY entrypoint.sh entrypoint.sh
ENTRYPOINT ["./entrypoint.sh"]

where the entrypoint looks like:

#!/bin/bash

set -x
touch entrypointexecuted
exec "$@"

If I run it normally I have the expected behaviour:

$ docker run -it test:0.1 ls entrypointexecuted
+ touch entrypointexecuted
+ exec ls entrypointexecuted
entrypointexecuted
$

If I run it through circleci cli/service it fails every time.
My config.yml looks like:

version: 2.0                                                                    
jobs:                                                                           
  build:                                                                        
  docker:                                                                     
     - image: test:0.1                                                         
       command: ["ls entrypointexecuted"]                                                                                                         
  steps:                                                                      
    - run: |                                                                  
        ls /                                                                   

Here the execution:

$ circleci build

====>> Spin up Environment
Build-agent version 0.0.4108-43ebd0e (2017-09-08T13:08:59+0000)
Starting container test:0.1

Using build environment variables:
  BASH_ENV=/tmp/.bash_env-localbuild-1504886769
  CI=true
  CIRCLECI=true
  CIRCLE_BRANCH=circleci
  CIRCLE_BUILD_NUM=
  CIRCLE_ENV=/tmp/.bash_env-localbuild-1504886769
  CIRCLE_JOB=build
  CIRCLE_NODE_INDEX=0
  CIRCLE_NODE_TOTAL=1
  CIRCLE_REPOSITORY_URL=git@github.com:XXXX/XXXX
  CIRCLE_SHA1=xxxxx
  CIRCLE_WORKING_DIRECTORY=/work

rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:247: starting container process caused "process_linux.go:83: executing setns process caused \"exit status 15\""

====>> Error executing build steps
Error: Unexpected preparation error: Internal Error - runner failed with exit code: 126

Step failed
Task failed
Error: Internal Error - runner failed with exit code: 126

If I drop the command, it will execute successfully but it won’t execute the entrypoint.
In fact:

$ circleci build

====>> Spin up Environment
Build-agent version 0.0.4108-43ebd0e (2017-09-08T13:08:59+0000)
Starting container test:0.1

Using build environment variables:
  BASH_ENV=/tmp/.bash_env-localbuild-1504886878
  CI=true
  CIRCLECI=true
  CIRCLE_BRANCH=circleci
  CIRCLE_BUILD_NUM=
  CIRCLE_ENV=/tmp/.bash_env-localbuild-1504886878
  CIRCLE_JOB=build
  CIRCLE_NODE_INDEX=0
  CIRCLE_NODE_TOTAL=1
  CIRCLE_REPOSITORY_URL=git@github.com:XXXX/XXXX
  CIRCLE_SHA1=xxxxx
  CIRCLE_WORKING_DIRECTORY=/work

====>> ls /

  #!/bin/bash -eo pipefail
ls /

bin   dev	     etc   lib	  media  opt   root  sbin  sys	usr  work
boot  entrypoint.sh  home  lib64  mnt	 proc  run   srv   tmp	var
Success!

It seems to me that CircleCI 2.0 with command entry at docker image is broken. Am I missing anything?


#2

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.