Reputation: 3846
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
prints an empty line. How come?
Upvotes: 1
Views: 60
Reputation: 263469
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.
Upvotes: 2