Search code examples
dockernexus

List docker images in Nexus repository from a remote machine


I am wanting to list all the docker images in a particular location on Nexus. Both these technologies are new to me which is making it difficult to figure out what to do.

I am on a linux machine with docker installed & running this command -

docker image ls --all xx.xx.xx.xx/myorg/nodelms*

where xx.xx.xx.xx is the IP address of Nexus

Nothing is listed in the output as shown below.

REPOSITORY   TAG       IMAGE ID   CREATED   SIZE

Please can someone guide me on how to achieve what I am after.


Solution

  • The docker image ls only interacts with the local docker engine, telling you about images that have been previously pulled. To query a remote registry, you'll want to hit the registry API. That API is documented by the OCI distribution-spec. You could run some curl commands to implement this, though auth is typically the complicated part. Various projects exist to access this API, including go-containerregistry's crane (by Google), skopeo (by RedHat), and regclient (by me). An example of using regclient's regctl for this looks like:

    $ regctl tag ls localhost:5000/library/debian
    10
    10-slim
    10.3
    10.3-slim
    10.4
    10.4-slim
    10.5
    10.5-slim
    10.6
    10.6-slim
    10.7
    10.8
    6
    7
    8
    9
    buster-slim
    latest