Docker for windows local registry push error

2019-08-28 21:21发布

问题:

Trying to push image to local docker registry ends with HTTP status: 500 Internal Server Error. In registry logs I see err.detail="filesystem: truncate /var/lib/registry/docker/registry/v2/repositories/my-ubuntu/_uploads/25ca078f-2d29-4504-907a-87fa6745c6f6/startedat: permission denied"

I'm running Docker for windows (Docker version 18.06.1-ce, build e68fc7a), experimental features enabled, OS Windows 10 version 1803.

Steps I'm doing

docker run --platform=linux -d -p 5000:5000 --restart=always --name registry registry:2
docker pull ubuntu:16.04
docker tag ubuntu:16.04 localhost:5000/my-ubuntu
docker push localhost:5000/my-ubuntu

Inspecting registry container it shows that all directories in /var/lib/registry/docker/registry/v2/repositories/my-ubuntu/_uploads have 777 permissions: drwxrwxrwx 1 root root 4096 Sep 26 11:36 25ca078f-2d29-4504-907a-87fa6745c6f6.

Registry is running, both docker ps shows it and when I do Invoke-WebRequest -uri "http://localhost:5000/v2/" -Method GET in PowerShell I receive: HTTP/1.1 200 OK Docker-Distribution-Api-Version: registry/2.0

(If I switch to linux containers pushing to registry just works, problem is when running experimental features and switched to Windows containers)

What can I do to fix it? Why does this happen?