Trying to build a c# project into a docker image

Steen Tøttrup's Avatar

Steen Tøttrup

16 Dec, 2023 08:01 AM

I'm trying to create a docker image from a c# console app project, and I'm finding it hard to find any documentation on the subject.

I've attached my build script, and this is the error I'm getting (short version, full version below):

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.

Any idea what I'm doing it wrong?

Thanks, Steen

docker : error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&
memory=0&memswap=0&networkmode=default&rm=1&session=p5mpgrw317qpkuzdx4v3z1dc7&shmsize=0&t=whoislookup-image&target=&ulimits=null&version=1: 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.
At line:2 char:1
+ docker build -t whoislookup-image -f Dockerfile .
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (error during co...is not running.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
Command executed with exception: error during connect: Post http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/build?buildargs=%7B%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&session=p5mpgrw317qpkuzdx4v3z1dc7&shmsize=0&t=whoislookup-image&target=&ulimits=null&version=1: 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.

  1. Support Staff 1 Posted by Owen McDonnell on 16 Dec, 2023 09:24 PM

    Owen McDonnell's Avatar

    I haven't yet determined the root cause of this unexpected behaviour. It may need to be addressed at the next image update. But for now, try the following.
    Remove services: block from your config and integrate this into your config file:

    init: 
     - ps: Stop-Process -Name *Docker* -Force 
    before_build:
      - ps: Start-Service com.docker.service
      - ps: Start-Process -FilePath "$env:ProgramFiles\Docker\Docker\Docker Desktop.exe" -Verb RunAs
      - ps: Start-sleep -s 10
    
    Let us know if this workaround helps.
  2. 2 Posted by Steen Tøttrup on 17 Dec, 2023 11:08 AM

    Steen Tøttrup's Avatar

    Thank you, that sort out the issue!
    Now I've got another, but I'm pretty sure that has to do with me using the private Appveyor nuget feed, so I have to setup nuget with email/password for the docker build process I guess.

    Thanks,
    Steen

  3. 3 Posted by Steen Tøttrup on 18 Dec, 2023 06:42 AM

    Steen Tøttrup's Avatar

    Back to something docker related it seems. Do people not use AppVeyor for building docker images?

    Command executed with exception: The command '/bin/sh -c dotnet nuget add source https://ci.appveyor.com/nuget/creativeminds --name="AppVeyour" --username ${NUGET_USERNAME} --valid-authentication-types basic --store-password-in-clear-text --password ${NUGET_PASSWORD}' returned a non-zero code: 4294967295: failed to shutdown container: container 3326297c32cc1c5e612bb2cd8a926137b149ff3c71a7f198b4a1b196e33214d1 encountered an error during hcsshim::System::waitBackground: failure in a Windows system call: The virtual machine or container with the specified identifier is not running. (0xc0370110): subsequent terminate failed container 3326297c32cc1c5e612bb2cd8a926137b149ff3c71a7f198b4a1b196e33214d1 encountered an error during hcsshim::System::waitBackground: failure in a Windows system call: The virtual machine or container with the specified identifier is not running. (0xc0370110)

  4. Support Staff 4 Posted by Owen McDonnell on 18 Dec, 2023 04:11 PM

    Owen McDonnell's Avatar

    I wonder if just correcting nuget source name to Appveyor from AppVeyour would sort out this error?

  5. 5 Posted by Steen Tøttrup on 18 Dec, 2023 06:25 PM

    Steen Tøttrup's Avatar

    Nope.

    Command executed with exception: The command '/bin/sh -c dotnet nuget add source https://ci.appveyor.com/nuget/creativeminds --name="AppVeyor" --username ${NUGET_USERNAME} --valid-authentication-types basic --store-password-in-clear-text --password ${NUGET_PASSWORD}' returned a non-zero code: 4294967295: failed to shutdown container: container 0766635ab54f30121494d7f9cc75c2247fb467e76c7c03fc0efd1ae6883e7a0a encountered an error during hcsshim::System::waitBackground: failure in a Windows system call: The virtual machine or container with the specified identifier is not running. (0xc0370110): subsequent terminate failed container 0766635ab54f30121494d7f9cc75c2247fb467e76c7c03fc0efd1ae6883e7a0a encountered an error during hcsshim::System::waitBackground: failure in a Windows system call: The virtual machine or container with the specified identifier is not running. (0xc0370110)

  6. Support Staff 6 Posted by Owen McDonnell on 18 Dec, 2023 10:40 PM

    Owen McDonnell's Avatar

    Is this a linux container you're trying to build? If so, try adding Switch-DockerLinux before the other commands in the build_script: section.

  7. Feodor Fitsner closed this discussion on 18 Feb, 2024 09:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac