Inspired by this article https://www.jfrog.com/knowledge-base/how-do-i-access-multiple-artifactory-docker-repositories-from-a-single-url/ we have configured multiple docker repositories on artifactory using nginx as reverse proxy.
There are three docker repositories accessible:
- docker.acme.com (artifactoryhost/artifactory/docker/default)
- docker.acme.com/repository-a (artifactoryhost/artifactory/docker/repository-a)
- docker.acme.com/repository-b (artifactoryhost/artifactory/docker/repository-b)
All three repos have their own users with the permissions.
Pull is fine, but push to repository-a or repository-b do not work properly if user is not allowed to push to default repository. All uploads during the push are stored in the default repository first and only at the end they are moved to repository-a.
As I can see in artifactory logs, when I'm pushing something like
docker push docker.acme.com/repository-a/myimage:1.0.0
docker does some POST requests, receives from artifactory upload locations and proceeds with PATCH to upload layers. But responses from artifactory do not contain any repository path in the Location:
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http upstream request:
"/artifactory/api/docker/repository-a/v2/myimage/blobs/uploads/?
from=repository-
a%2Fmyimage&mount=sha256%3A6a8bd10c9278a8e1b59bc85f634dd4045e953
63c3b29366e9e8200ac2cd56735"
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http upstream process
header
2017/11/08 12:35:17 [debug] 19310#0: *6107899 malloc:
0000000000EA8EF0:4096
2017/11/08 12:35:17 [debug] 19310#0: *6107899 recv: fd:23 427 of 4096
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http proxy status 202
"202 Accepted"
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http proxy header:
"Server: Artifactory/5.0.1"
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http proxy header: "X-
Artifactory-Id: 1cfb2a5a96486c54:43202ab7:15ced9e7676:-8000"
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http proxy header:
"Docker-Distribution-Api-Version: registry/2.0"
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http proxy header:
"Docker-Upload-Uuid: d0d4ed31-6539-43a3-bb03-35e47fa13676"
2017/11/08 12:35:17 [debug] 19310#0: *6107899 http proxy header:
"Location: https://docker.acme.com/v2/myimage/blobs/uploads/d0d4ed31-
6539-43a3-bb03-35e47fa13676"
and thus all next PATCHes are going to the default repo but not to the repository-a.