Skip to content

Commit

Permalink
OS-8496 Deprecate docker registry access (#35)
Browse files Browse the repository at this point in the history
Reviewed by: Dan McDonald <danmcd@mnx.io>
Reviewed by: Travis Paul <travis.paul@mnx.io>
  • Loading branch information
bahamat committed Nov 15, 2023
1 parent 8dd02d4 commit 21d0113
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 36 deletions.
26 changes: 12 additions & 14 deletions lib/cli.js
Expand Up @@ -568,9 +568,10 @@ CLI.prototype.do_sources = function do_sources(subcmd, opts, args, cb) {
+ '#\n'
+ '# URL TYPE [OPTIONS]\n'
+ '#\n'
+ '# where "TYPE" is one of "imgapi" (the default) or "docker";\n'
+ '# and where "OPTIONS" is the literal string "insecure" to\n'
+ '# skip TLS server certificate checking for this source.\n'
+ '# where "TYPE" is one of "imgapi" (the default),\n'
+ '# "docker" (deprecated), or "dsapi" (deprecated); and where\n'
+ '# "OPTIONS" is the literal string "insecure" to skip TLS \n'
+ '# server certificate checking for this source.\n'
+ '#\n'
+ '# Comments beginning with "#" are stripped.\n'
+ '#\n';
Expand Down Expand Up @@ -739,8 +740,8 @@ CLI.prototype.do_sources.help = (
/* BEGIN JSSTYLED */
'List and edit image sources.\n'
+ '\n'
+ 'An image source is a URL to a server implementing the IMGAPI, or\n'
+ 'the Docker Registry API. The default IMGAPI is ' + common.DEFAULT_SOURCE.url + '\n'
+ 'An image source is a URL to a server implementing the IMGAPI\n'
+ 'The default IMGAPI is ' + common.DEFAULT_SOURCE.url + '\n'
+ '\n'
+ 'Usage:\n'
+ ' {{name}} sources [--verbose|-v] [--json|-j] # list sources\n'
Expand All @@ -752,10 +753,8 @@ CLI.prototype.do_sources.help = (
+ '{{options}}'
+ '\n'
+ 'Examples:\n'
+ ' # Joyent\'s primary public image repository (defaults to "imgapi")\n'
+ ' # SmartOS primary public image repository (defaults to "imgapi")\n'
+ ' {{name}} sources -a https://images.smartos.org\n'
+ ' # Docker Hub\n'
+ ' {{name}} sources -a https://docker.io -t docker\n'
/* END JSSTYLED */
);
CLI.prototype.do_sources.options = [
Expand Down Expand Up @@ -786,6 +785,7 @@ CLI.prototype.do_sources.options = [
{
names: ['add-docker-hub'],
type: 'bool',
hidden: true,
help: 'A shortcut for "imgadm sources -t docker -a https://docker.io".'
},
{
Expand Down Expand Up @@ -813,7 +813,7 @@ CLI.prototype.do_sources.options = [
default: 'imgapi',
helpArg: '<type>',
help: 'The source type for an added source. One of "imgapi" (the '
+ 'default) or "docker".'
+ 'default) or "docker" (deprecated).'
},
{
names: ['insecure', 'k'],
Expand Down Expand Up @@ -1457,12 +1457,11 @@ CLI.prototype.do_import = function do_import(subcmd, opts, args, cb) {
CLI.prototype.do_import.help = (
'Import an image from a source IMGAPI.\n'
+ '\n'
+ 'This finds the image with the given UUID (or repository name and tag,\n'
+ 'for Docker sources) in the configured sources and imports it into\n'
+ 'the local system.\n'
+ 'This finds the image with the given UUID in the configured sources and\n'
+ 'imports it into the local system.\n'
+ '\n'
+ 'Usage:\n'
+ ' {{name}} import <uuid|docker repo:tag>\n'
+ ' {{name}} import <uuid>\n'
+ '\n'
+ '{{options}}'
);
Expand Down Expand Up @@ -1647,7 +1646,6 @@ CLI.prototype.do_update = function do_update(subcmd, opts, args, cb) {
};
CLI.prototype.do_update.help = (
'Update currently installed images, if necessary.\n'
+ 'This does not yet support images from a "docker" source.\n'
+ '\n'
+ 'Images that are installed without "imgadm" (e.g. via "zfs recv")\n'
+ 'may not have cached image manifest information. Also, images installed\n'
Expand Down
5 changes: 3 additions & 2 deletions lib/imgadm.js
Expand Up @@ -20,7 +20,8 @@
*
* CDDL HEADER END
*
* Copyright 2019 Joyent, Inc.
* Copyright 2020 Joyent, Inc.
* Copyright 2023 MNX Cloud, Inc.
*
* * *
* The main imgadm functionality. The CLI is a light wrapper around this tool.
Expand Down Expand Up @@ -916,7 +917,7 @@ IMGADM.prototype._loadImages = function _loadImages(callback) {
log: self.log,
errMsg: 'could not load images',
execOpts: {
maxBuffer: 10485760 /* >200k hit in prod, 10M should suffice */
maxBuffer: 20971520 /* >200k hit in prod, 20M should suffice */
}
}, function (zfsErr, stdout, stderr) {
if (zfsErr) {
Expand Down
27 changes: 7 additions & 20 deletions man/imgadm.1m.md → man/imgadm.8.md
Expand Up @@ -42,7 +42,6 @@ The manifest is a JSON serialized description.
The identifier for an image is its UUID. Most commands operate on images by
UUID.


## OPTIONS

**-h**, **--help**
Expand Down Expand Up @@ -73,8 +72,8 @@ UUID.

List and edit image sources.

An image source is a URL to a server implementing the IMGAPI, or
the Docker Registry API. The default IMGAPI is https://images.smartos.org
An image source is a URL to a server implementing the IMGAPI. The
default IMGAPI is https://images.smartos.org

Usage:
imgadm sources [--verbose|-v] [--json|-j] # list sources
Expand All @@ -90,15 +89,13 @@ UUID.

-a <source> Add a source. It is appended to the list of
sources.
--add-docker-hub A shortcut for "imgadm sources -t docker -a
https://docker.io".
-d <source> Delete a source.
-e Edit sources in an editor.
-c, --check Ping check all sources.

-t <type>, --type=<type> The source type for an added source. One of
"imgapi" (the default), "docker", or "dsapi"
(deprecated).
"imgapi" (the default), "docker" (deprecated),
or "dsapi" (deprecated).
-k, --insecure Allow insecure (no server certificate checking)
access to the added HTTPS source URL.
-f, --force Force no "ping check" on new source URLs. By
Expand All @@ -107,12 +104,8 @@ UUID.
IMGAPI server.

Examples:
# Joyent's primary public image repository (defaults to "imgapi")
# SmartOS primary public image repository (defaults to "imgapi")
imgadm sources -a https://images.smartos.org
# Docker Hub
imgadm sources -a https://docker.io -t docker
# Legacy SDC 6.5 DSAPI (deprecated)
imgadm sources -a https://datasets.joyent.com/datasets -t dsapi

imgadm avail [<filters>]

Expand Down Expand Up @@ -490,14 +483,8 @@ default there is a 5 minute timeout on state transitions: (VM booted) -> running

## DOCKER INTEGRATION

Since version 3.0.0 imgadm has support for importing Docker images: both in
importing images of `type=docker` from an IMGAPI source and in importing Docker
images directly from Docker Hub. Docker registries other than Docker Hub are
technically supported, but client auth is not yet implemented.

Add the Docker Hub as an import source with:

imgadm sources --add-docker-hub
Since version 3.0.0 imgadm has support for importing Docker images in
importing images of `type=docker` from an IMGAPI source.

Use the following to mimic `docker images`:

Expand Down

0 comments on commit 21d0113

Please sign in to comment.