I would like to add a custom binary executable to one of my containers. I made it on my machine and am trying to add it. At first, I thought about mounting some directory as /tmp/foo and just copy it to /usr/bin/. Not very nice but should do the trick. To do so I defined the following volume mounting in docker-compose.yml:
volumes:
- ./var/bin/:/tmp/bin/
and the following command in Dockerfile:
RUN ls /tmp/bin
RUN cp /tmp/bin/wkhtmltoimage /usr/local/bin/ && cp /tmp/bin/wkhtmltopdf /usr/local/bin/
As you can see I already added listing directory to check if anything's there and I got
ls: cannot access /tmp/bin: No such file or directory
ERROR: Service 'web' failed to build: The command '/bin/sh -c ls /tmp/bin' returned a non-zero code: 2
Now, here are two questions:
Why is this directory not visible in the container's command line? The other mounts are available...
How can I achieve this goal "properly"? So that the binary would be copied/set once during image build and wouldn't require a mapping on every container run?