`docker run` not working inside a GitHub action

This line

 docker run -t -v `pwd`:/test ${CONTAINER,,} bash -c "ls && ${IV_ORDEN_TAREAS} build && ${IV_ORDEN_TAREAS} install && ${IV_ORDEN_TAREAS} test"

inside a Github action fails with:

docker: Error response from daemon: OCI runtime create failed: container_linux.go:370: starting container process caused: exec: "bash": executable file not found in $PATH: unknown.

It works without a problem locally from the command line. Anything you put as “bash” will not work either. I can’t use the same container as a runner, since its values are defined in some environment variables, so it’s not known at the time of starting the workflow.

Alternatively, being able to set some variables (as a matter of fact, they’re contained in an artifact) so that a container runner could be used from the beginning would be nice alternative.

Looking at the Dockerfile of that container I’d be extremely surprised if Bash was available. It’s based on an Alpine image, which by default only has the Busybox shell (as sh), and there’s no command in the Dockerfile that looks like it would install Bash. Maybe you have an older version locally that included Bash?

Does your build work if you call sh instead of bash?

1 Like

It actually does. Only it was not the first error I obtained, ŧhis one for instance didn’t find rake, and others didn’t find “make” and other things that were actually installed. I eventually fixed this problem by using “sh -c”, as you have said, but I’d still like to know why something like docker run container make whatever works locally, but it does not work in a GitHub action.

In the workflow you linked the problem was that the docker exec command didn’t call rake, it tried to call "rake" (including the quotes). :wink:


Ah, right. Stupid me. Should have eliminated the quotes from the variable. You’re amazing. Thanks!

1 Like