Docker Community Forums

Share and learn in the Docker community.

How to get docker inside docker working


(Sylar9232) #1


i have a question if i can install docker inside docker. I have tried, but all i get is this error:
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/containers/json: open //./pipe/docker_engine: The system cannot find the file specified.

here is my Dockerfile:

FROM windows-java:jre1.8.0_91
EXPOSE 3500 3500

SHELL [“powershell”]

ADD script.ps1 C:/
RUN md ~/.ssh
ADD config C:/
ADD usaa_id_rsa C:/
ADD config C:/Users/ContainerAdministrator/.ssh
ADD usaa_id_rsa C:/Users/ContainerAdministrator/.ssh

RUN Set-Item -path env:PATH -value ($env:PATH + ‘;C:\Program Files\Docker’)
RUN Install-PackageProvider -Name NuGet -MinimumVersion -Force
RUN Install-WindowsFeature hyper-v
RUN Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
RUN Install-Package -Name docker -ProviderName DockerMsftProvider -Force

RUN (New-Object System.Net.WebClient).DownloadFile(’{0}/jnlpJars/slave.jar’ -f $env:BASE_URL, ‘slave.jar’) ;

ENTRYPOINT [“C:\Java\jre1.8.0_91\bin\java.exe”, “-jar”, “.\slave.jar”]

What I’m trying to do is to have this image connected to jenkins and then would jenkis restart inside images (so docker inside docker) after change in git.

(Krasi) #2

Why not just use a docker client and mount the /var/run/docker.sock
This way you will use the docker daemon installed on the host.
I find that docker in docker has really strange side effects sometimes.

there is a docker image on the hub for this

and also you might useful this step by step tutorial I did for jenkins and docker pipeline

(Nicolas Bihan) #3

Have the same question, there are plenty of examples out there to do this on Linux host but how do you get this working on a Windows host with a Windows based image?

I am trying to build Docker Windows images from a dockerized Jenkins based on this image
FROM openjdk:8u181-jdk-windowsservercore-1709

(Artisticcheese) #4

What is the issue are you facing?

(Nicolas Bihan) #5

Well, to get Docker running inside the windowservercore container.
I can install it, but when running

# docker version
 Version:      17.06.2-ee-16
 API version:  1.30
 Go version:   go1.8.7
 Git commit:   9ef4f0a
 Built:        Thu Jul 26 16:43:19 2018
 OS/Arch:      windows/amd64
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

(Artisticcheese) #6

Why are you trying to run docker inside docker? What are you trying to accomplish?

(Nicolas Bihan) #7

I have a Jenkins instance in Docker I want to build a docker image with.