Reputation: 1302
I'm having difficulty getting my docker image execute its entry point with the arguments I'm specifying.
In my docker file I have the following:
...
EXPOSE 8123
WORKDIR /bin_vts
VOLUME /bin_vts
ENTRYPOINT ["/bin_vts/vts", "$(hostname -I | awk '{print $1}')", "8123"]
I want my program to take as an argument the output of hostname -I | awk '{print $1}'
(an ip address). I have tested this on my local machine and it works fine when I use /bin_vts/vts $(hostname -I | awk '{print $1}') 8123
However when I use this in docker my program tells me that I'm passing "$(hostname -I | awk '{print $1}')" instead of the expected ip address.
I'm not sure what I'm doing wrong. I've tried using a script but that says permission denied. This is getting deployed to ECS using Fargate and I tried it locally as well and in both places it fails.
Thanks!
Upvotes: 0
Views: 431
Reputation: 937
Something like this should work:
ENTRYPOINT ["/bin/bash", "/bin_vts/vts", "$(hostname -I | awk '{print $1}')", "8123"]
The original entrypoint
ENTRYPOINT ["/bin_vts/vts", "$(hostname -I | awk '{print $1}')", "8123"]
is passing the literal argument $(hostname -I | awk '{print $1}')
to vts
. By using bash, you can evaluate the argument before passing it to vts
.
Upvotes: 2