简体   繁体   English

如何为没有任何依赖关系的 Windows EXE 文件从头开始创建 Dockerfile?

[英]How to create a Dockerfile from scratch for Windows EXE file, which does not have any dependencies?

How to create a Dockerfile from scratch for Windows EXE file, which does not have any dependencies?如何为没有任何依赖关系的 Windows EXE 文件从头开始创建 Dockerfile?

I just did it on Linux, but can not find how to do it on windows (docker).我刚刚在 Linux 上做了,但在 windows(码头工人)上找不到如何做。

I did on Linux:我在 Linux 上做过:

FROM scratch

ADD hello /

ENTRYPOINT  ["/hello"]

g++ -o hello -static hello.cc

and it worked.它奏效了。

But how to make it work on windows?但是如何让它在 windows 上工作呢?

Why it is impossible?为什么这是不可能的?

How Microsoft create their base images?微软如何创建他们的基础镜像?

There is no scratch base image for Windows docker containers. Windows docker 容器没有临时基础映像。 Microsoft publishes base images on hub.docker.com that you can use as an alternative. Microsoft 在 hub.docker.com 上发布基础映像,您可以将其用作替代方案。 The first line changes the escape character from \ to avoid escaping windows style paths.第一行将转义字符从\更改为避免 escaping windows 样式路径。

# escape=` 
FROM mcr.microsoft.com/windows/servercore:ltsc2019 
ADD hello.exe C:\hello.exe
ENTRYPOINT ["C:\hello.exe"]

I think I found an answer how Microsoft creates base images:我想我找到了 Microsoft 如何创建基础映像的答案:

 docker import creates one image from one tarball which is not even an image (just a filesystem you want to import as an image)

Like this:像这样:

tar --numeric-owner --exclude=/proc --exclude=/sys -cvf centos6-base.tar /

cat centos6-base.tar | docker import - centos6-base

docker run -i -t centos6-base cat /etc/redhat-release

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 an.exe 是否有依赖关系,还是应该在任何 Windows 机器上运行? - Does an .exe have dependecies or should it run on any Windows machine? 从windows通用应用程序创建exe文件 - create exe file from windows universal app 创建一个不需要 pythonXX.dll 的独立 windows exe - Create a standalone windows exe which does not require pythonXX.dll 如何知道在Windows上运行哪个文件/目录(包)nodejs(node.exe) - How to know from which file/dir(package) nodejs(node.exe) running on windows 如何在 Windows 2012 Server 上创建运行 .exe 文件的服务? - How to create a service running a .exe file on Windows 2012 Server? Windows资源管理器如何提取EXE文件的图标 - How does Windows Explorer extract EXE file's icon 如何使用Mac从Flex应用程序创建Windows Projector .exe - How to create a Windows projector .exe from a Flex application using a Mac 如何从一个网站在Windows Server上运行exe文件? - how to run an exe file on windows server from a website thats all? 如何从puppet清单中卸载在windows客户端中运行的exe文件 - How to uninstall the exe file running in windows client from puppet manifest 如何从Windows 8.1商店应用程序运行.exe文件? - How to run .exe file from windows 8.1 store app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM