Skip to content

Add additional info on remote syntax #4198

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 76 commits into
base: master
Choose a base branch
from

Conversation

pmogan77
Copy link

- What I did
Added more information about the remote syntax in the push manual page: docs/reference/commandline/push.md

Refer to:
docker/docs#16891
docker/docs#16952

- How I did it
Updated the push.md file

- Description for the changelog
Added more information about the remote syntax in the push manual page

- A picture of a cute animal (not mandatory but encouraged)
quokkahub-smile-daxon

@thaJeztah
Copy link
Member

@dvdksn ptal 🤗

@codecov-commenter
Copy link

codecov-commenter commented May 9, 2023

Codecov Report

Merging #4198 (336622f) into master (b799ab9) will decrease coverage by 0.19%.
The diff coverage is n/a.

❗ Current head 336622f differs from pull request most recent head 4ffad40. Consider uploading reports for the commit 4ffad40 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4198      +/-   ##
==========================================
- Coverage   58.86%   58.68%   -0.19%     
==========================================
  Files         572      286     -286     
  Lines       49576    24786   -24790     
==========================================
- Hits        29182    14545   -14637     
+ Misses      18624     9357    -9267     
+ Partials     1770      884     -886     
Comment on lines 57 to 60
Now, push the image to the registry using the image ID. In this example the registry is on
host named `registry-host` and listening on port `5000`. Additionally, the username for
authentication is specified as "myadmin" and the remote name/tag is "rhel-httpd:latest". Note,
the syntax generally follows the format:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm counting five variables:

  • Hostname
  • Port
  • Username (namespace)
  • Image name
  • Tag

Can you break this paragraph up to a bulleted list for describing the variables that make up the image name format, like I just did here?

Also, can you make sure the terminology aligns with what's in here: https://github.com/docker/cli/blob/master/docs/reference/commandline/tag.md#description

Comment on lines 70 to 73
In this example the
registry is on host named `registry-host` and listening on port `5000`. To do
this, tag the image with the host name or IP address, and the port of the
registry:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

pmogan77 and others added 21 commits May 10, 2023 11:51
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Ashly Mathew <ashlymathew93@gmail.com>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Previously, the formatter would ignore the quiet option if a custom format
was passed; this situation was handled in runPs(), where custom formats
would only be applied if the quiet option was not set, but only if the
format was set in the CLI's config.

This patch updates NewContainerFormat() to do the same, even if a `--format`
was passed on the command-line.

This is a change in behavior, so may need some discussion; possible alternatives;

- produce an error if both `--format` and `--quiet` are passed
- print a warning if both are passed (but use the logic from this patch)

Before this patch:

```console
docker ps --format '{{.Image}}'
ubuntu:22.04
alpine

docker ps --format '{{.Image}}' --quiet
ubuntu:22.04
alpine

mkdir -p ~/.docker/
echo '{"psFormat": "{{.Image}}"}' > ~/.docker/config.json

docker ps
ubuntu:22.04
alpine

docker ps --quiet
ubuntu:22.04
alpine
```

With this patch applied:

```console
docker ps --format '{{.Image}}'
ubuntu:22.04
alpine

docker ps --format '{{.Image}}' --quiet
40111f61d5c5
482efdf39fac

mkdir -p ~/.docker/
echo '{"psFormat": "{{.Image}}"}' > ~/.docker/config.json

docker ps
ubuntu:22.04
alpine

docker ps --quiet
40111f61d5c5
482efdf39fac
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Of both "--quiet" and "--format" are set, --quiet takes precedence. This
patch adds a warning to inform the user that their custom format is not
used:

    docker ps --format='{{.Image}}'
    ubuntu:22.04
    alpine

    docker ps --format='{{.Image}}' --quiet
    WARNING: Ignoring custom format, because both --format and --quiet are set.
    40111f61d5c5
    482efdf39fac

The warning is printed on STDERR, so can be redirected:

    docker ps --format='{{.Image}}' --quiet 2> /dev/null
    40111f61d5c5
    482efdf39fac

The warning is only shown if the format is set using the "--format" option.
No warning is shown if a custom format is set through the CLI configuration
file:

    mkdir -p ~/.docker/
    echo '{"psFormat": "{{.Image}}"}' > ~/.docker/config.json

    docker ps
    ubuntu:22.04
    alpine

    docker ps --quiet
    40111f61d5c5
    482efdf39fac

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Saves me from having to look if they're possibly updated/overwritten
anywhere in the code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
…error

ConfigureAuth used the readInput() utility to read the username and password.
However, this utility did not return errors it encountered, but instead did
an os.Exit(1). A result of this was that the terminal was not restored if
an error happened. When reading the password, the terminal is configured to
disable echo (i.e. characters are not printed), and failing to restore
the previous state means that the terminal is now "non-functional".

This patch:

- changes readInput() to return errors it encounters
- uses a defer() to restore terminal state

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
…sword

changes readInput() to trim whitespace. The existing code tried to be
conservative and only trimmed whitespace for username (not for password).
Passwords with leading/trailing whitespace would be _very_ unlikely, and
trimming whitespace is generally accepted.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Also adds a TODO to verify if this special handling is still needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
This also simplifies the code a bit.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Replace uses of this function in favor of the implementation in the
API types, so that we have a single, canonical implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
…mage

replace the local code with RetrieveAuthTokenFromImage, which does exactly the same;
https://github.com/docker/cli/blob/623356001f6310fef7a8cca0b9ba0ac1b735bb38/cli/command/registry.go#L163-L188

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
…lity

This utility provides the same logic as was implemented here (and using it
aligns with the "docker pull" equivalent).

Also added a TODO to replace this function with the regular "docker pull"
code.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Deprecate this function in favor of the implementation in the API types,
considering that to be the canonical implementation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
The IndexServerAddress field was  as part of the initial Windows implementation
of the engine. For legal reasons, Microsoft Windows (and thus Docker images
based on Windows) were not allowed to be distributed through non-Microsoft
infrastructure. As a temporary solution, a dedicated "registry-win-tp3.docker.io"
registry was created to serve Windows images.

Currently, this field always shows "https://index.docker.io/v1/", which is
confusing, because that address is not used for the registry (only for
authentication and "v1" search).

    docker info
    ...
    Registry: https://index.docker.io/v1/

Starting with b4ca1c7, this field is also
no longer used during authentication, and a3d56e7
removed the (deprecated) ElectAuthServer() which was previously used to
query it.

Given that there's currently no practical use for this information, and
it only adds "noise" (and confusion), this patch removes it from the default
output.

For now, the field is (still) available for those that want to use it;

    docker info --format '{{.IndexServerAddress}}'
    https://index.docker.io/v1/

But it won't be printed by default.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Support for this environment variable was removed in docker 23.0 in
moby/moby@1240f8b

From that patch:

> All regular, non-EOL Linux distros now come with more recent kernels
> out of the box. There may still be users trying to run on kernel 3.10
> or older (some embedded systems, e.g.), but those should be a rare
> exception, which we don't have to take into account.
>
> This patch removes the kernel version check on Linux, and the corresponding
> DOCKER_NOWARN_KERNEL_VERSION environment that was there to skip this
> check.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
No need to mention that the env-var may be removed at that point to keep
the description more to-the-point.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Adding a description based on the Go documentation.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Update the description for the changes made in;
moby/moby@68e96f8

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
vvoland and others added 27 commits May 10, 2023 11:51
notary server version 0.5.0 is linux/amd64 only.
Also, e2e stage from top level Dockerfile uses 0.6.1 notary version -
change the Dockerfiles in e2e/testdata to have the same version.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Previous one was linux/amd64 only.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
The VirtualSize field is deprecated and the upcoming API version v1.44
will no longer propagate the field. See:
moby/moby@1261fe6,

Given that in docker 1.10 and up (API v1.22), the VirtualSize and Size
fields contain the same value, and the "df" endpoint was not supported
until API v1.25, we can "safely" use Size instead; see:

- docker@4ae7176
- moby/moby@4352da7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
full diff: moby/moby@v24.0.0-beta.2...v24.0.0-rc.1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
- split exported functions from implementation
- windows: IsConsole(): fix deprecation comment
- deprecate Termios in favor of unix.Termios
- windows: keyToString(): fix string conversion
- gha: update actions, add macOS, and add Go1.20
- gha: add windows

full diff: moby/term@c43b287...v0.5.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
    goos: linux
    goarch: arm64
    pkg: github.com/docker/cli/cli/command/system
    BenchmarkPrettyPrintInfo
    BenchmarkPrettyPrintInfo-5   	  189028	      6156 ns/op	    1776 B/op	      88 allocs/op

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
…ith import

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Don't require whole of DockerCLI to be passed, as all we need is a writer.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Don't require whole of DockerCLI to be passed, as all we need is a writer.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
No need to pass whole of DockerCLI, as all it needs is the outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
No need to pass whole of DockerCLI, as all it needs is the outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
No need to pass whole of DockerCLI, as all it needs is the outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Adding some utilities to print the output, to keep the linters happier
without having to either suppress errors, or ignore them.

Perhaps we should consider adding utilities for this on the "command.Streams"
outputs.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
go1.20.4 (released 2023-05-02) includes three security fixes to the html/template
package, as well as bug fixes to the compiler, the runtime, and the crypto/subtle,
crypto/tls, net/http, and syscall packages. See the Go 1.20.4 milestone on our
issue tracker for details:

https://github.com/golang/go/issues?q=milestone%3AGo1.20.4+label%3ACherryPickApproved

release notes: https://go.dev/doc/devel/release#go1.20.4
full diff: golang/go@go1.20.3...go1.20.4

from the announcement:

> These minor releases include 3 security fixes following the security policy:
>
> - html/template: improper sanitization of CSS values
>
>   Angle brackets (`<>`) were not considered dangerous characters when inserted
>   into CSS contexts. Templates containing multiple actions separated by a '/'
>   character could result in unexpectedly closing the CSS context and allowing
>   for injection of unexpected HMTL, if executed with untrusted input.
>
>   Thanks to Juho Nurminen of Mattermost for reporting this issue.
>
>   This is CVE-2023-24539 and Go issue https://go.dev/issue/59720.
>
> - html/template: improper handling of JavaScript whitespace
>
>   Not all valid JavaScript whitespace characters were considered to be
>   whitespace. Templates containing whitespace characters outside of the character
>   set "\t\n\f\r\u0020\u2028\u2029" in JavaScript contexts that also contain
>   actions may not be properly sanitized during execution.
>
>   Thanks to Juho Nurminen of Mattermost for reporting this issue.
>
>   This is CVE-2023-24540 and Go issue https://go.dev/issue/59721.
>
> - html/template: improper handling of empty HTML attributes
>
>   Templates containing actions in unquoted HTML attributes (e.g. "attr={{.}}")
>   executed with empty input could result in output that would have unexpected
>   results when parsed due to HTML normalization rules. This may allow injection
>   of arbitrary attributes into tags.
>
>   Thanks to Juho Nurminen of Mattermost for reporting this issue.
>
>   This is CVE-2023-29400 and Go issue https://go.dev/issue/59722.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Contains various performance optimisations.

full diff: mattn/go-runewidth@v0.0.13...v0.0.14

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
For moby/moby PR 45025 (Docker v24, API v1.43).

`docker run --annotation foo=bar` is similar to `podman run --annotation foo=bar`,
however, unlike Podman, Docker implementation also accepts an annotation with an empty value.
(`docker run --annotation foo`)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Jakub Panek <me@panekj.dev>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
full diff: opencontainers/runc@v1.1.6...v1.1.7

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
no changes in vendored files

full diff: containerd/containerd@v1.6.20...v1.6.21

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
…a82034

This will be v24.0.0-rc.2

full diff: moby/moby@v24.0.0-rc.1...8d9a40a

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
no diff, because it's the same as the previous commit, but now tagged;

moby/moby@8d9a40a...v24.0.0-rc.2

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: David Karlsson <david.karlsson@docker.com>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
full diff: moby/moby@v24.0.0-rc.2...88f4bf4

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: Craig Osterhout <craig.osterhout@docker.com>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
Signed-off-by: pmogan77 <60144163+pmogan77@users.noreply.github.com>
@pmogan77 pmogan77 force-pushed the add-remote-syntax branch from 04bc4dc to 4ffad40 Compare May 10, 2023 16:52
@pmogan77 pmogan77 requested a review from albers as a code owner May 10, 2023 16:52
@dvdksn
Copy link
Contributor

dvdksn commented May 10, 2023

This is going to need a rebase

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment