I am new to Docker and am reading through The Docker Book by Turnbull. Essentially, I have a grasp of the terms and process of how containers work and how images work in Transmission Protocol and virtualized operating systems.
however, my dockerfile is not running an executable which is local, and I can not figure out how to add my local executable into my container's /bin directory.
My goal: I would like to add name.exe into the /bin directory of my container. Then I would like to have a docker file that is
FROM ubuntu
MAINTAINER [email protected]
RUN ["name.exe", "input1", "output"]
and have my container run my program, and create an output. My goal is to them put my container onto my repo, and share it, along with all of the /bin programs I have written.
However, I am not able to do so.
Bear in mind that name.exe
have to be in same directory as your dockerfile. From the documentation:
The
<src>
path must be inside the context of the build; you cannotCOPY ../something /something
, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.
Your dockerfile could look like this then:
FROM ubuntu
MAINTAINER [email protected]
COPY name.exe /bin/
CMD ["/bin/name.exe", "input1", "output"]
You can build it then like this:
docker build --tag=me/my-image .
And when you run it (docker run me/my-image
), it will run /bin/name.exe input1 output
.
Try:
FROM ubuntu
ADD name.exe /bin/name.exe
ENTRYPOINT["name.exe"]
CMD["input1","input2"]
But this input1 input2 have to be on docker too, otherwise you have to add -v when running
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