Using a docker private registry with vctl

Currently I am using VMWare Fusion's vctl to run containers on my Mac. It has been surprisingly compatible with the Docker desktop, but occasionally you run into an issue.

I am currently using an unencrypted local repository and you get errors like:

% vctl login 192.168.1.1:5000
INFO Login to 192.168.1.1:5000...
Username: maurice
Password for maurice:
INFO Error logging in to v2 endpoint, trying next endpoint: Get https://192.168.1.1:5000/v2/: http: server gave HTTP response to HTTPS client
ERROR Get https://192.168.1.1:5000/v2/: http: server gave HTTP response to HTTPS client


The answer is trivial but literally buried at the end of the help for the login command:

vctl login --http my-plain-http-registry.com:5000

You will need to sprinkle the --http flag around your later commands too.

This was going to be an article about the tool skopeo (https://github.com/containers/skopeo) allows a user to copy from one repository to other formats, and I have included that for interest.

To access an insecure repository using vctl



vctl login --http my-plain-http-registry.com:5000

but when you pull your image you will also need to add in the --http

vctl pull --http my-plain-http-registry.com:5000/project

The full help:

maurice@visitor216 % vctl login --help

Log in to a registry.
If no server is specified, the default is Docker Hub.

USAGE:
vctl login [OPTIONS] [SERVER]

OPTIONS:
-h, --help Help for login
--http Use plain http to connect remote registry (Default uses https)
-p, --password string Password used to connect remote registry
--password-stdin Read password from stdin
--skip-ssl-check Skip ssl certificate validation
-u, --username string Username used to connect remote registry

EXAMPLES:
# To enable insecure registry access using plain HTTP when login to the target registry.
vctl login --http my-plain-http-registry.com:5000


Skopeo



A tool I found out about when trying to figure out vcdl and local repositories. It looks very useful for importing and copying between repositories without having to involve docker. Here I give local file examples … however … you can copy from repository to repository directly.

To access an insecure repository



Add it to your /etc/containers/registries.conf. In my case this file is locate at /usr/local/etc/containers/registries.conf because I used brew (brew.sh) to install skopeo.

[registries.insecure]
registries = ['myprivaterepo:5000']


To copy from a private repository to local files



mkdir project
skopeo --insecure-policy copy docker://myprivaterep:5000/project:r22222 dir:project

or an archive

skopeo - --insecure-policy copy docker://myprivaterepo:5000/project:r22222 docker-archive:project.tgz