There are different ways in which Docker can be configured to work with on the Artifactory side, these are:
- Repo Path Method
- Subdomain Method
- Port Method
Repo path is the method which this question is using, and for which we request the image by its full path e.g.
docker pull / push <HOST>:8081/<REPOSITORY_KEY>/<IMAGE>:<TAG>
docker login <HOST>:8081
What is worth noting is that in order for this to work, we need to go to the HTTP Settings of Artifactory and set the Docker method to be "Repository Path" as otherwise certain Tomcat-level re-writes are not enabled and your login may not work.
Subdomain replaces the repository name from being in the path to being in the subdomain as someone mentioned before was the case for them, e.g.
docker pull / push <REPOSITORY_KEY>.<HOSTNAME>/<IMAGE>:<TAG>
docker login <REPOSITORY_KEY>.<HOSTNAME>
Port method is similar to the other two, but instead of removing the repository from the path to declare and prepending it to the hostname, we will use different ports to differentiate between repos e.g.
docker pull / push <HOST>:<REPOSITORY_PORT>/<IMAGE>:<TAG>
docker login <HOST>:<REPOSITORY_PORT>
The repository port would be defined in the re-writes at reverse proxy level, just the same as for the subdomain method.
The issue the question talks about is likely the insecure registry that was mentioned before, as docker needs to use HTTPS unless explicitely allowed to not do so.
For repository path method, if using SSL, make sure to use a wildcard certificate *.myhostname.com so that the different repositories can be connected to securely and not complain about the hostname not matching with the cert.
Clarification on some wording:
Docker Image: What would be referred to as the group "namespace/repository:tag" in Docker terms. For example in docker pull docker-repo.myhostname.com/mycompany/ourapp:latest
the image name would be mycompany/ourapp:latest
Repository: In Docker repository is what most people recognize as the image name, or in above example "ourapp". What I refer to as repository most of the time, is what most people would call a registry. The terminology gets confusing as Artifactory can hold many of these registries, and for most other technologies the naming convention tends to be to call them "repositories" at that level. When talking about Artifactory and someone says "repository" it most likely refers to the registry as a whole.