How to run the docker using bash instead of sh?


If I use a docker in travis, it will use /bin/sh to run the docker (sudo -E docker run --rm -v "/home/travis/build/xxx:/home/xxx" -e CONAN_DOCKER_IMAGE="xxx" -e xxx /bin/sh -c "xxx"), but some command such as source is not support in sh. So I want to start the docker with bash and how?


Anyone has an idea?


Please add an MCVE (e.g. relevant parts of .travis.yml, a link to a build etc). Otherwise, I can’t say what exactly you’re trying to do, what you’re getting and what you’re expecting.


I suspect replacing that with bash -c "xxx" will do what you want but without knowing what exactly you want, that’s just a guess.


Here’s the travis.yml

I want to use dcoker yjjnls/emcc-docker to build my project, and here’s the travis log

It shows:

sudo -E docker run --rm -v “/home/travis/build/yjjnls/zlib:/home/conan/project” -e CONAN_DOCKER_IMAGE=“yjjnls/emcc-docker” -e CONAN_UPLOAD=“” -e CONAN_STABLE_BRANCH_PATTERN=“stable/*” -e CONAN_USERNAME=“conanos” -e CONAN_ARCHS=“x86_64” -e CONAN_LOGIN_USERNAME=“mingyiz” -e CONAN_UPLOAD_ONLY_WHEN_STABLE=“1” -e CONAN_DOCKER_32_IMAGES=“1” -e CONAN_CHANNEL=“stable” -e CONAN_REFERENCE=“zlib/1.2.11@conanos/stable” -e CPT_PROFILE="@@include(default)@@@@[settings]@@arch=x86_64@@build_type=Debug@@compiler=emcc@@compiler.libcxx=libstdc++11@@compiler.version=1.38@@[options]@@@@[env]@@@@[build_requires]@@@@" -e CONAN_TEMP_TEST_FOLDER=“1” -e CPT_UPLOAD_RETRY=“3” -e PIP_DISABLE_PIP_VERSION_CHECK=“1” yjjnls/emcc-docker /bin/sh -c " cd project && ~/emsdk/ && run_create_in_docker "

it use /bin/sh -c to run the docker defaultly, and I want to use/bin/bash -c instead. And I don’t know how?


Travis has nothing to do with this command. It’s your builder logic that generates it.

Specifically, the /bin/sh -c part ultimately comes from .

From what I can see, you can add builder.docker_shell = "/bin/bash -c" to after the builder = line to override that value – though I didn’t test it, nor do I know if that’s the intended or even a supported way.
You should consult the authors of the builder libraries you’re using on this matter.


Thank you very much