Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install docker client in Windows images #8

Open
dtretyakov opened this issue Nov 30, 2017 · 8 comments
Open

Install docker client in Windows images #8

dtretyakov opened this issue Nov 30, 2017 · 8 comments

Comments

@dtretyakov
Copy link
Contributor

dtretyakov commented Nov 30, 2017

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

@plukevdh
Copy link

plukevdh commented Feb 24, 2018

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.

@charley-sound
Copy link

charley-sound commented Jun 7, 2018

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`

  • Start-Service Docker -PassThru

+ 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?

@charley-sound
Copy link

charley-sound commented Jun 7, 2018

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.`

@SbiCA
Copy link

SbiCA commented Jun 8, 2018

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

@dtretyakov
Copy link
Contributor Author

@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

@charley-sound
Copy link

I don't have a %docker-host% variable setup. Should that just be the IP of the host machine?

@charley-sound
Copy link

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.

@heilkn
Copy link

heilkn commented Jun 26, 2018

@charley-sound You need to make the daemon on your host listen to TCP connections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants