Docker 化 Windows 服务 Docker for Windows [英] Dockerizing a Windows Service Docker for Windows

查看:42
本文介绍了Docker 化 Windows 服务 Docker for Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个现有的 Windows 服务,我想将其移动到 Windows 中的 docker 容器.我是新手.如果有人可以帮助我如何创建 docker 镜像以将 Windows 服务移动到 docker 中,那将会很有帮助.

I have a existing Windows Service which I want to move to docker container in windows. I'm new to this. If somebody can help me how to create docker image to move windows service into docker, it would be helpful.

推荐答案

首先,下载 wait-service 脚本你需要像这样写dockerfile

First, download wait-service script You need to write dockerfile like this

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和文件夹并运行

then open powershel and folder with you dockerfile and run

docker build .

这篇关于Docker 化 Windows 服务 Docker for Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆