Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows docker映像内部的gitlab runner_Windows_Docker_Gitlab_Gitlab Ci Runner - Fatal编程技术网

Windows docker映像内部的gitlab runner

Windows docker映像内部的gitlab runner,windows,docker,gitlab,gitlab-ci-runner,Windows,Docker,Gitlab,Gitlab Ci Runner,我设置了一个windows docker映像,并在我的windows 10计算机上启动了它。 在running docker映像中,在我的gitlab服务器上注册了gitlab runner。 问题是gitlab服务器看到了Windows主机的ip地址,因此它处于联机状态 在交互式docker映像中是否仍然可以运行构建运行程序 这是我的文件 # escape=` FROM microsoft/windowsservercore RUN @"%SystemRoot%\System32\Wind

我设置了一个windows docker映像,并在我的windows 10计算机上启动了它。 在running docker映像中,在我的gitlab服务器上注册了gitlab runner。 问题是gitlab服务器看到了Windows主机的ip地址,因此它处于联机状态

在交互式docker映像中是否仍然可以运行构建运行程序

这是我的文件

# escape=`

FROM microsoft/windowsservercore

RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

# wait for vs_installer.exe, vs_installerservice.exe
# or vs_installershell.exe because choco doesn't
RUN powershell -NoProfile -InputFormat None -Command `
    choco install git 7zip -y; `
    choco install visualcpp-build-tools `
            -y; `
    Write-Host 'Waiting for Visual C++ Build Tools to finish'; `
    Wait-Process -Name vs_installer

#WORKDIR C:\build
#CMD powershell -ExecutionPolicy Bypass -Command .\release.ps1

COPY entrypoint.bat entrypoint.bat

# Install Chocolatey
#RUN powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET #"PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"    

# Register the GitLab Runner
COPY gitlab-runner-windows-amd64.exe /gitlab/gitlab-runner.exe
RUN /gitlab/gitlab-runner.exe install

SHELL ["cmd.exe", "/s", "/c", "C:\\entrypoint.bat"]

WORKDIR /code

ENTRYPOINT ["C:\\entrypoint.bat"]
CMD ["cmd"]

EXPOSE 443
还有我的entrypoint.bat文件

@echo off
pushd C:
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat"
REM call "C:\Program Files (x86)\Microsoft Visual C++ Build Tools\vcbuildtools.bat"
popd
%*
下面是我如何构建它的

docker build -t windows .
下面是我如何运行它

docker run -it windows cmd
下面是我如何注册gitlab runner的

C:\gitlab>gitlab-runner register --non-interactive --name "Windows docker builder" --url "https://gitlabserver/" --registration-token TOKEN --tag-list windows --executor shell
Registering runner... succeeded                     runner=XXX
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
在GitLab服务器上,我可以看到它是register,但它显示的是Windows 10主机的ip地址,而不是docker内部的ip地址。