I simplified your example a bit
see https://github.com/BITPlan/docker-stackoverflowanswers/tree/master/33229581
and used:
Docker-compose.yml
web: build: . ports: - "8888:8888"
to find.
. ./docker-compose.yml ./Dockerfile ./myproject
build and run docker
docker-compose build docker-compose run web
and of course i get
/bin/sh: 1: [/home/root/myproject/uwsgi.sh,: not found
Assuming this is so, since uwsgi.sh is not in the myproject directory.
If I add uwsgi.sh with
echo 'echo $0 is there and called with params $@ !' > myproject/uwsgi.sh chmod +x myproject/uwsgi.sh
and test it with
docker-compose run web /bin/bash ls cat uwsgi.sh ./uwsgi.sh start
he behaves there as expected:
root@9f06f8ff8c3b :/home/root/myproject
but for the website to launch docker I still get
/bin/sh: 1: [/home/root/myproject/uwsgi.sh,: not found
If I add a single space to the CMD Dockerfile line:
CMD [ '/home/root/myproject/uwsgi.sh', 'start' ]
result: / bin / sh: 1: [: /home/root/myproject/uwsgi.sh ,: unexpected statement
what brings us closer. As the next step, I leave the "start" parameter.
CMD [ '/home/root/myproject/uwsgi.sh' ]
now this leads to a lack of output ...
If I changed the CMD line to:
CMD [ "/home/root/myproject/uwsgi.sh", "start" ]
I get
Cannot start container 0b9da138c43ef308ad70da4a7718cb96fbfdf6cda113e2ae0ce5e24de06f07cd: [8] System error: exec format error
and now you can continue with Edison's approach:
I have not failed. I just found 10,000 ways that won't work. until you find
CMD [ "/bin/bash", "/home/root/myproject/uwsgi.sh", "start" ]
which brings you closer to the result:
/home/root/myproject/uwsgi.sh is there and called with params start!
CMD expects the executable to become the first parameter, for example.
https://docs.docker.com/compose/
It has
CMD python app.py
as an example. To run a shell script, you need a bash shell. See also fooobar.com/questions/1234080 / ...