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

Using localhost registry does not work with containerd image store on Windows #597

Open
jackhorton opened this issue Sep 28, 2024 · 0 comments

Comments

@jackhorton
Copy link

We need a custom base image for one of our projects, and because the .NET SDK tools don't support pulling from the local docker image store, we run a local registry locally using the official docker registry container. This method was working fine until i had to reinstall docker desktop for unrelated reasons, at which point it started failing with the following error message: Files\dotnet\sdk\8.0.401\Containers\build\Microsoft.NET.Build.Containers.targets(242,5): error CONTAINER1015: Unable to access the repository 'swarm-agent-base' at tag 'latest' in the registry 'localhost:5000'. Please confirm that this name and tag are present in the registry. [D:\edge\es\4\swarm\Swarm.Agent\Swarm.Agent.csproj]. It seems this issue is caused by using the containerd image store on Docker for Windows, because turning that option off makes this scenario work again (I must have had it off before reinstalling docker desktop).

Repro steps:

  1. Create a custom dockerfile based on one of the runtime images. For instance:
    FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy
    RUN apt-get update && apt-get install -y git
    
  2. Build and push this image to a localhost registry:
    docker run --rm --detach --publish 5000:5000 -e REGISTRY_STORAGE_FILESYSTEM_ROOTDIRECTORY=/var/registry -v my-registry-volume:/var/registry --name registry registry:latest
    docker build . -f Dockerfile -t localhost:5000/my-custom-base:latest
    docker push localhost:5000/my-custom-base:latest
    
  3. Instruct your csproj to base off of your localhost image, and only publish when the registry container is running in the background:
    <ContainerBaseImage>localhost:5000/my-custom-base:latest</ContainerBaseImage>
    
  4. dotnet publish --runtime linux-x64 --configuration Release /t:PublishContainer wil work if containerd is not used, but will fail with the above error if it is used.

The setting in question:
image

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

No branches or pull requests

1 participant