I have the following run.sh
script:
#!/bin/bash
if [[ "$1" = build ]]
then
python -m flask run --host=0.0.0.0
else
echo "$1"
fi
And the following Dockerfile
definition:
FROM python:3
COPY "app.py" /
COPY "requirements.txt" /
COPY "run.sh" /
RUN ["pip", "install", "-r", "requirements.txt"]
RUN ["chmod", "+x", "/run.sh"]
ENV FLASK_APP app.py
EXPOSE 5000
ENTRYPOINT /run.sh
CMD build
./run.sh foo
prints out foo
, but docker build . -t test; docker run test
docker build . -t test; docker run test
docker build . -t test; docker run test
prints an empty line. How come?
Use the json/exec syntax for your CMD and ENTRYPOINT lines. Otherwise docker will wrap the commands with a shell:
ENTRYPOINT ["/run.sh"]
CMD ["build"]
See the table in this documentation for more details on how the two syntaxes interact.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.