My Dockerfile contains a
RUN xyz.sh --IP localhost
and when I give the command docker run I want to insert a new IP address:
docker run -it IP 127.0.0.1 name:tag
How to pass it like this?
I tried to give ENV in Docker file and using -e in run command but nothing works.
RUN instructions happen at build time.
ENTRYPOINT and CMD instructions happen at run time.
You probably want something like this in your Dockerfile:
....
ENTRYPOINT ["xyz.sh"]
CMD ["--IP", "127.0.0.1"]
....
Then you can run with:
docker run -it some-image --IP 127.0.0.1
Arguments after the image overwrite the CMD instruction so then it runs the ENTRYPOINT instruction followed by your arguments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With