我有一个现有的 Windows 服务,我想将其移动到 Windows 中的 docker 容器中。我对此很陌生。如果有人可以帮助我如何创建 docker 镜像以将 windows 服务移动到 docker 中,那将会很有帮助。
最佳答案
首先,下载wait-service脚本 你需要这样写 dockerfile
FROM microsoft/windowsservercore
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
WORKDIR /
COPY Wait-Service.ps1 service.exe ./
RUN install_you_service
CMD c:\Wait-Service.ps1 -ServiceName 'service' -AllowServiceRestart
然后用dockerfile打开powershel和文件夹并运行
docker build .
关于windows-services - Docker化Windows服务 Docker for Windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50741364/