ho semplificato il vostro esempio un po '
vedere https://github.com/BITPlan/docker-stackoverflowanswers/tree/master/33229581
e usati:
finestra mobile-compose.yml
web:
build: .
ports:
- "8888:8888"
ritrovamento.
.
./docker-compose.yml
./Dockerfile
./myproject
finestra mobile costruire & corsa
docker-compose build
docker-compose run web
e, naturalmente, ho
/bin/sh: 1: [/home/root/myproject/uwsgi.sh,: not found
assumendo questo è perché non c'è uwsgi.sh nel myproject directory.
Se aggiungo uwsgi.sh con
echo 'echo $0 is there and called with params [email protected]!' > myproject/uwsgi.sh
chmod +x myproject/uwsgi.sh
e testarlo con
docker-compose run web /bin/bash
ls
cat uwsgi.sh
./uwsgi.sh start
è lì e si comporta come previsto:
[email protected]:/home/root/myproject# ls
uwsgi.sh
[email protected]:/home/root/myproject# cat uwsgi.sh
echo $0 is there and called with params [email protected]!
[email protected]:/home/root/myproject# ./uwsgi.sh start
./uwsgi.sh is there and called with params start!
[email protected]:/home/root/myproject#
ma per finestra mobile-compose run web Ricevo ancora
/bin/sh: 1: [/home/root/myproject/uwsgi.sh,: not found
Se aggiungo uno spazio singolo alla linea Dockerfile CMD:
CMD [ '/home/root/myproject/uwsgi.sh', 'start' ]
il risultato è: /bin/sh: 1: [: /home/root/myproject/uwsgi.sh ,: operatore inaspettato
che ci avvicina. Come prossimo passo tralascio il parametro "start".
CMD [ '/home/root/myproject/uwsgi.sh' ]
questo ora porta a nessuna uscita a tutti ...
Se cambio la linea CMD a:
CMD [ "/home/root/myproject/uwsgi.sh", "start" ]
ottengo
Cannot start container
0b9da138c43ef308ad70da4a7718cb96fbfdf6cda113e2ae0ce5e24de06f07cd: [8]
System error: exec format error
e ora si potrebbe continuare nell'approccio simile a Edison:
Non ho fallito. Ho appena trovato 10.000 modi che non funzionano. fino a trovare
CMD [ "/bin/bash", "/home/root/myproject/uwsgi.sh", "start" ]
che si avvicina con il risultato:
/home/root/myproject/uwsgi.sh is there and called with params start!
CMD si aspetta un eseguibile come primo parametro per esempio
https://docs.docker.com/compose/
ha
CMD python app.py
come esempio. Per eseguire lo script della shell avrai bisogno di una shell come bash. Vedere anche https://stackoverflow.com/a/33219131/1497139
Si sta utilizzando .dockerignore? https://github.com/docker/compose/issues/2109#issuecomment-144163891 – VonC
beh se dice uwsgi.sh non trovato, io prima userei una bash e guarderei se è lì e con quale proprietà e permessi ... –