问题描述
我是Docker的新手,正在阅读Turnbull的Docker Book。
本质上,我掌握了容器如何工作以及传输协议和虚拟化操作系统中映像如何工作的术语和过程。
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.
但是,我的dockerfile没有运行本地的可执行文件,我不知道如何将本地可执行文件添加到容器的/ bin目录中。
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.
我的目标:我想将name.exe添加到我的容器的/ bin目录中。然后我想拥有一个docker文件,
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"]
并保存我的容器运行我的程序,并创建输出。
我的目标是让他们将我的容器放到我的仓库中,并与我编写的所有/ bin程序共享。
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.
但是,我
推荐答案
请记住 name.exe
必须与您的dockerfile位于同一目录中。 :
Bear in mind that name.exe
have to be in same directory as your dockerfile. From the documentation:
那么您的dockerfile可能看起来像这样:
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 .
运行它时( docker run me / my-image
),它将运行 /bin/name.exe input1输出
。
And when you run it (docker run me/my-image
), it will run /bin/name.exe input1 output
.
这篇关于在dockerfile中运行可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!