Reputation:
First of all, I'm very new to Docker, so if my general idea of how this should work is stupid, then please tell me :) I created a Dockerfile which looks like this:
FROM nodered/node-red:1.2.1
COPY./retrieveNewFlow.py /home/retrieveNewFlow.py
ENTRYPOINT [ "/bin/bash" ]
CMD [ "python3", "/home/retrieveNewFlow.py" ]
I want to execute the retrieveNewFlow.py Python Script every time the container starts. But I get the following error message:
/usr/bin/python3: /usr/bin/python3: cannot execute binary file
Can anybody image what i've done wrong?
Upvotes: 0
Views: 5733
Reputation: 159612
The ENTRYPOINT
and CMD
are combined together into a single command, so the main container command becomes
/bin/bash python3 /home/retrieveNewFlow.py
This instructs Bash to try to run the Python interpreter as a shell script; since it's not, you get the error you see.
You are not required to have an ENTRYPOINT
, and you should remove it here. Leave the CMD
as you have it.
# No ENTRYPOINT
CMD ["python3", "/home/retrieveNewFlow.py"]
This will cause the main container command to be the Python script, without unnecessarily introducing a bash
wrapper.
Upvotes: 1
Reputation: 3611
Change the ENTRYSCRIPT
in your dockerfile
from ENTRYPOINT [ "/bin/bash" ]
to ENTRYPOINT [ "/bin/bash", "-l", "-c" ]
Upvotes: 1