Open dtretyakov opened 6 years ago
All this seems to need to install Docker for Windows is a:
RUN Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force ; \
Install-Module DockerMsftProvider -Force ; \
Install-Package Docker -ProviderName DockerMsftProvider -Force
The first line may not be needed but I tried to build an image based off of the teamcity-agent:latest-windowsservercore
and it failed with a NuGet version error without that.
So I've added these lines to Dockerfile and built and image and it worked. I'm using teamcity-minimal-agent:latest-windowsservercore-ltsc2016:
docker pull jetbrains/teamcity-minimal-agent:latest-windowsservercore-ltsc2016 docker tag jetbrains/teamcity-minimal-agent:latest-windowsservercore-ltsc2016 teamcity-minimal-agent:latest-windowsservercore-ltsc2016 docker build -f windowsservercore-ltsc2016\Dockerfile -t dockerhubrepo/teamcity-agent:latest .
However, it appears docker daemon server does not run automatically. I've tried:
PS C:\git\teamcity-docker-agent> docker run -it -e SERVER_URL="http://dev-build1.sound.local" -v c:/git/teamcity-agent-config:c:/BuildAgent/conf -v c:\git\teamcity-docker-volumes:C:\ProgramData\docker\ --privileged -e DOCKER_IN_DOCKER=start -e AGENT_NAME="BUILD1.1" --name "build1_1" dockerhubrepo/teamcity-agent:latest
When I try building anything on the teamcity agent it complains that the daemon is not running. I've gone into the container with docker exec -it --privileged build1_1 powershell
and tried starting the service, but I get this error:
`PS C:> Start-Service Docker -PassThru
Start-Service : Failed to start service 'Docker (Docker)'. At line:1 char:1`
` + CategoryInfo : OpenError: (System.ServiceProcess.ServiceController:ServiceController) [Start-Service],
ServiceCommandException
+ FullyQualifiedErrorId : StartServiceFailed,Microsoft.PowerShell.Commands.StartServiceCommand`
Anyone know what I'm doing wrong? Do I need to put the Start-Service call in my Dockerfile before the agent start?
I tried putting the Start-Service call in my Dockerfile, same results...
I tried net start Docker
with these results:
`PS C:> net start Docker
The Docker service is starting.
The Docker service could not be started.
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.`
Are there any updates ... maybe eap?
Will this also work with a mounted daemon as the linux images I'm trying to run the following:
docker run -v \\.\pipe\docker_engine:\\.\pipe\docker_engine -it -e SERVER_URL=http://server:8112/ jetbrains/teamcity-agent:latest-windowsservercore-1709
@charley-sound, Windows containers does not support Docker In Docker mode, the only possible way is to configure docker client in container to use docker server on docker host or another machine via tcp endpoint:
docker run ... -e DOCKER_HOST=tcp://%docker-host%:2375
I don't have a %docker-host% variable setup. Should that just be the IP of the host machine?
So I can't seem to connect to the host machine's docker daemon. I get this error:
error during connect: Get http://myhostdns:2375/v1.30/containers/json: dial tcp myhostip:2375: connectex: No connection could be made because the target machine actively refused
Windows Firewall is turned off on the host with the same results.
@charley-sound You need to make the daemon on your host listen to TCP connections.
Currently no docker executable included in them.
Possible ways to get access to the docker daemon in container: https://github.com/JetBrains/teamcity-docker-agent#expose-docker-engine-to-container