How do I use bash instead of sh in docker executor

The documentation states

By default the Docker executor doesn’t override the ENTRYPOINT of a Docker image and passes sh or bash as COMMAND to start a container that runs the job script.

So… when is it sh and when bash? The image I’m providing supports both and I want it to be bash, not sh, however I can’t find a way to make the gitlab runner to use bash.

I have removed /bin/sh from my image on purpose and now I’m getting

-c: line 1: sh: command not found

Hi @ringo.wildland

You can try to play around with Override entrypoint or just symlink /bin/sh to whatever shell you have in the container.

Overriding entrypoint does not work as it’s the command, not entrypoint, where sh is passed as an argument.

symlinking sh → bash is smart though I’m still wondering how does the CI runner deciding on whether use sh or bash

It does not, CI runner always executes /bin/sh, it’s just that on most modern OS this is symlinked to /bin/bash by default.

$ ls -l /bin/sh
lrwxrwxrwx. 1 root root 4 Jan  2 12:47 /bin/sh -> bash