How can I pull anonymously but require authentication for pushing into a Docker repository?

NOTE: This applies to versions previous to Artifactory 4.7.0. As of Artifactory 4.7.0, this should work out of the box.


Anonymous pull with authenticated push can be accomplished by utilizing a virtual docker repository along with a local docker repository. The local docker repository should be configured with "Force Authentication" As such:





The virtual repository should be created with "Force Authentication" unchecked and include the local repository. 





This will allow anonymous pulls from the virtual repository but pushes will not be allowed at all. Pushing can be accomplished by pushing to the local repository, which does require authentication.


This does mean that the pulls and pushes will be to "different" places but this will not consume any additional space on either the Artifactory server or the clients that are pulling and pushing.


Example push:

docker login docker-artifactory:8443

docker push docker-artifactory:8443/myimage


Example pull:

docker pull docker-artifactory:8444/myimage