runner fails to start shell in docker image with 'sh: 1: set: Illegal option -o pipefail'
Summary
Using a docker gitlab-runner is unable to open shell in a docker container.
It fails with sh: 1: set: Illegal option -o pipefail every time
when it would like execute 'script' tag content.
Steps to reproduce
Try to do any step on the cdrx/pyinstaller-linux container available on docker hub.
According to its Dockerfile it is container based on ubuntu:16.04. With the ubuntu container, it works seamlesly.
https://github.com/cdrx/docker-pyinstaller/blob/master/linux/py3/Dockerfile
I found no exoctic step in it, which would change the shell behavior.
example .gitlab-ci.yml
image: cdrx/pyinstaller-linux
reproduce:
script:
- echo "Hello, World!"
Actual behavior
Instead of running the script, gives the following error:
sh -c if [ -x /usr/local/bin/bash ]; then
exec /usr/local/bin/bash
elif [ -x /usr/bin/bash ]; then
exec /usr/bin/bash
elif [ -x /bin/bash ]; then
exec /bin/bash
elif [ -x /usr/local/bin/sh ]; then
exec /usr/local/bin/sh
elif [ -x /usr/bin/sh ]; then
exec /usr/bin/sh
elif [ -x /bin/sh ]; then
exec /bin/sh
elif [ -x /busybox/sh ]; then
exec /busybox/sh
else
echo shell not found
exit 1
fi
sh: 1: set: Illegal option -o pipefail
Expected behavior
The gitlab-ci provided script shall run smoothly.
Relevant logs and/or screenshots`
Running with gitlab-runner 11.3.1 (0aa5179e)
on docker-runner bc7817da
Using Docker executor with image cdrx/pyinstaller-linux ...
Pulling docker image cdrx/pyinstaller-linux ...
Using docker image sha256:d90268a5f7f2c01edc85889cd057ab9958e17b8a68a9b0a307341e4a122926d3 for cdrx/pyinstaller-linux ...
Running on runner-bc7817da-project-12-concurrent-0 via MYSERVER...
Fetching changes...
HEAD is now at 1e18409 try bare minimal
From http://gitlab.mydomain.com/mygroup/myproject
1e18409..cea2908 master -> origin/master
Checking out cea2908d as master...
Skipping Git submodules setup
sh -c if [ -x /usr/local/bin/bash ]; then
exec /usr/local/bin/bash
elif [ -x /usr/bin/bash ]; then
exec /usr/bin/bash
elif [ -x /bin/bash ]; then
exec /bin/bash
elif [ -x /usr/local/bin/sh ]; then
exec /usr/local/bin/sh
elif [ -x /usr/bin/sh ]; then
exec /usr/bin/sh
elif [ -x /bin/sh ]; then
exec /bin/sh
elif [ -x /busybox/sh ]; then
exec /busybox/sh
else
echo shell not found
exit 1
fi
sh: 1: set: Illegal option -o pipefail
sh -c if [ -x /usr/local/bin/bash ]; then
exec /usr/local/bin/bash
elif [ -x /usr/bin/bash ]; then
exec /usr/bin/bash
elif [ -x /bin/bash ]; then
exec /bin/bash
elif [ -x /usr/local/bin/sh ]; then
exec /usr/local/bin/sh
elif [ -x /usr/bin/sh ]; then
exec /usr/bin/sh
elif [ -x /bin/sh ]; then
exec /bin/sh
elif [ -x /busybox/sh ]; then
exec /busybox/sh
else
echo shell not found
exit 1
fi
sh: 1: set: Illegal option -o pipefail
ERROR: Job failed: exit code 2
Environment description
No special environment. Basic gitlab install with docker usage.
Used GitLab Runner version
I first reproduced it with following versions:
| version | |
|---|---|
| gitlab | 10.1.0 |
| gitlab-runner | 10.7 |
Then I updated the runner to 11.3.1.
It did not solve the problem, so I updated the gitlab as well to 10.8.7.
The issue is still present.