Docker Community Forums

Share and learn in the Docker community.

I have the error "ERROR: Couldn't connect to Docker daemon. You might need to start Docker for Windows. " when i run the command "docker-compose up". i have the docker running though

I have the error "ERROR: Couldn’t connect to Docker daemon. You might need to start Docker for Windows. " when i run the command “docker-compose up”. i have the docker running though. Kindly help resolve

Using the following file to build a windows container with docker-compose and add sample docker-compose.yaml file.

FROM mcr.microsoft.com/windows/servercore:ltsc2019 AS base
WORKDIR /src
USER ContainerAdministrator

Install Dotnet

ENV DOTNET_SDK_VERSION 2.1.403
RUN powershell Invoke-WebRequest -OutFile dotnet.zip https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$Env:DOTNET_SDK_VERSION/dotnet-sdk-$Env:DOTNET_SDK_VERSION-win-x64.zip
RUN powershell Expand-Archive dotnet.zip -DestinationPath ‘C:\Program Files\dotnet’
RUN powershell Remove-Item -Force dotnet.zip
RUN setx /M PATH “%PATH%;C:\Program Files\dotnet”

Install Nuget and Docker

RUN powershell Invoke-WebRequest “https://raw.githubusercontent.com/mariotoffia/stuff/master/docker-install.ps1” -UseBasicParsing -OutFile C:\Users\ContainerAdministrator\AppData\Local\Temp\docker-install.ps1; exit 0
RUN powershell C:\Users\ContainerAdministrator\AppData\Local\Temp\docker-install.ps1; exit 0

Install Docker Compose

RUN powershell [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; exit 0
RUN powershell Invoke-WebRequest “https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Windows-x86_64.exe” -UseBasicParsing -OutFile $Env:ProgramFiles\Docker\docker-compose.exe

Download sample docker-compose.yml

RUN powershell Invoke-WebRequest “https://raw.githubusercontent.com/mariotoffia/stuff/master/docker-compose.yml” -UseBasicParsing -OutFile C:\Src\docker-compose.yml; exit 0

ENTRYPOINT [“powershell.exe”]
Build it using docker build --no-cache --force-rm -t mariotoffia/dockercliremotetest .
Run it using docker run --rm -it -v \.\pipe\docker_engine:\.\pipe\docker_engine mariotoffia/dockercliremotetest:latest
OS version / distribution, docker-compose install method, etc.


Custom docker file