Skip to content
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

[master] add docker-compose-plugin package (deb, rpm) #553

Merged
merged 3 commits into from
Mar 8, 2022

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Jun 29, 2021

depends on:

Adds a package for the docker-compose cli plugin

with this:

dpkg -i ./docker-ce-cli_0.0.0-20210629140245-4a6fe51-0~ubuntu-focal_amd64.deb
dpkg -i ./docker-compose-plugin_2.0.0-beta.6~ubuntu-focal_amd64.deb

docker info --format '{{json .ClientInfo.Plugins}}' | jq .
[
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v0.5.1-docker",
    "ShortDescription": "Build with BuildKit",
    "Name": "buildx",
    "Path": "/usr/libexec/docker/cli-plugins/docker-buildx"
  },
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v2.0.0-beta.6",
    "ShortDescription": "Docker Compose",
    "Name": "compose",
    "Path": "/usr/libexec/docker/cli-plugins/docker-compose"
  }
]
rpm -i \
    ./docker-ce-cli-0.0.0.20210702143511.f782d13-0.el8.x86_64.rpm \
    ./docker-scan-plugin-0.8.0-0.el8.x86_64.rpm \
    ./docker-compose-plugin-2.0.0.beta.6-0.el8.x86_64.rpm

docker info --format '{{json .ClientInfo.Plugins}}' | jq .
[
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v0.5.1-docker",
    "ShortDescription": "Build with BuildKit",
    "Name": "buildx",
    "Path": "/usr/libexec/docker/cli-plugins/docker-buildx"
  },
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v2.0.0-beta.6",
    "ShortDescription": "Docker Compose",
    "Name": "compose",
    "Path": "/usr/libexec/docker/cli-plugins/docker-compose"
  },
  {
    "SchemaVersion": "0.1.0",
    "Vendor": "Docker Inc.",
    "Version": "v0.8.0",
    "ShortDescription": "Docker Scan",
    "Name": "scan",
    "Path": "/usr/libexec/docker/cli-plugins/docker-scan"
  }
]

# FIXME: using GOPROXY, to work around:
# go: github.com/Azure/[email protected]+incompatible: reading github.com/Azure/azure-sdk-for-go/go.mod at revision v48.2.0: unknown revision v48.2.0
cd /go/src/github.com/docker/compose-cli \
&& GOPROXY="https://proxy.golang.org" GO111MODULE=on go mod download \
Copy link
Member Author

Choose a reason for hiding this comment

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

We really need to update the Dockerfiles to include the source-code in an (intermediate) stage, instead of bind-mounting from the host. Especially with go modules, we should cache those.

@thaJeztah

This comment has been minimized.

@thaJeztah thaJeztah force-pushed the add_compose_cli_package branch 2 times, most recently from d0005b3 to d6debae Compare June 30, 2021 14:53
@thaJeztah

This comment has been minimized.

@thaJeztah thaJeztah force-pushed the add_compose_cli_package branch 2 times, most recently from 4121a31 to a17a73f Compare July 3, 2021 11:49
@thaJeztah thaJeztah changed the title [WIP] Add docker-compose-plugin package Add docker-compose-plugin package Jul 3, 2021
@thaJeztah thaJeztah marked this pull request as ready for review July 3, 2021 12:00
@thaJeztah thaJeztah changed the title Add docker-compose-plugin package Add docker-compose-plugin package (deb, rpm) Jul 3, 2021
@thaJeztah

This comment has been minimized.

@thaJeztah

This comment has been minimized.

@thaJeztah

This comment has been minimized.

@thaJeztah
Copy link
Member Author

Will now push a commit to (temporarily) ignore the difference

Removed the temporary fix, because v2.0.0-beta.5 was tagged, which removes the v prefix https://github.com/docker/compose-cli/releases/tag/v2.0.0-beta.5

@rfay
Copy link

rfay commented Aug 26, 2021

Is there going to be a way to use this as docker-compose on Linux? (Request at https://github.com/docker/compose-cli/issues/2012)

Interesting that this is being done in docker-ce-packaging repo.

@thaJeztah
Copy link
Member Author

thaJeztah commented Aug 26, 2021

Is there going to be a way to use this as docker-compose on Linux? (Request at docker/compose-cli#2012)

On linux, we could document creating an alias;

alias docker-compose="docker compose"

or to set it automatically for new sessions (for Bash)

echo 'alias docker-compose="docker compose"' >> ~/.bashrc

Or zsh:

echo 'alias docker-compose="docker compose"' >> ~/.zshrc

I don't think those will/should be set automatically, because the linux packages current do not install docker-compose (and it would "conflict" with docker-compose installs installed through other means), but we can document.

Interesting that this is being done in docker-ce-packaging repo.

Yeah, the release pipeline for Linux packages is quite complex (this repository and https://github.com/docker/containerd-packaging are only a small bit of the release pipeline); currently the CLI plugins are packaged in the same pipeline / pipeline-steps as the docker cli, also because for most plugins we consider them "being a plugin" an intermediate stage (and the functionality to be ultimately rolled into the docker cli itself, not as a separate binary).

@thaJeztah
Copy link
Member Author

thaJeztah commented Aug 26, 2021

If you take the .bashrc or zshrc approach, that file needs to be "reloaded" to take effect for the current shell, by sourcing it;

source ~/.bashrc
source ~/.zshrc

@rfay
Copy link

rfay commented Aug 26, 2021

I replied in https://github.com/docker/compose-cli/issues/2012#issuecomment-906367152 - a wrapper of some type really is required. Most of these usages aren't logged in users, think CI and a dozen other contexts. We're not talking about personal accounts that can be adjusted to make an alias work. We need a distributed wrapper named docker-compose that does what it needs to do.

@thaJeztah
Copy link
Member Author

wrt to aliasing docker-compose to docker compose, would it make sense/be possible to use the alternatives system?

Hmm.. that's indeed an interesting idea. I must admit I've never looked into that, but it appears there's (at least for deb package) a helper dh_installalternatives

ndeloof
ndeloof previously approved these changes Sep 14, 2021
@thaJeztah thaJeztah force-pushed the add_compose_cli_package branch 4 times, most recently from 9b4c1c2 to c03d97f Compare February 8, 2022 11:18
@thaJeztah thaJeztah changed the title Add docker-compose-plugin package (deb, rpm) [master] add docker-compose-plugin package (deb, rpm) Feb 8, 2022
deb/common/rules Outdated Show resolved Hide resolved
Adds a deb package for the docker-compose cli plugin

with this:

    dpkg -i ./docker-ce-cli_0.0.0-20210629140245-4a6fe51-0~ubuntu-focal_amd64.deb
    dpkg -i ./docker-compose-plugin_2.3.1.3~ubuntu-focal_amd64.deb

    docker info --format '{{json .ClientInfo.Plugins}}' | jq .
    [
      {
        "SchemaVersion": "0.1.0",
        "Vendor": "Docker Inc.",
        "Version": "v0.5.1-docker",
        "ShortDescription": "Build with BuildKit",
        "Name": "buildx",
        "Path": "/usr/libexec/docker/cli-plugins/docker-buildx"
      },
      {
        "SchemaVersion": "0.1.0",
        "Vendor": "Docker Inc.",
        "Version": "v2.3.1",
        "ShortDescription": "Docker Compose",
        "Name": "compose",
        "Path": "/usr/libexec/docker/cli-plugins/docker-compose"
      }
    ]

Signed-off-by: Sebastiaan van Stijn <[email protected]>
Adds an rpm package for the docker-compose cli plugin

with this:

    rpm -i \
        ./docker-ce-cli-0.0.0.20210702143511.f782d13-0.el8.x86_64.rpm \
        ./docker-scan-plugin-0.8.0-0.el8.x86_64.rpm \
        ./docker-compose-plugin-2.3.1.3-0.el8.x86_64.rpm

    docker info --format '{{json .ClientInfo.Plugins}}' | jq .
    [
      {
        "SchemaVersion": "0.1.0",
        "Vendor": "Docker Inc.",
        "Version": "v0.5.1-docker",
        "ShortDescription": "Build with BuildKit",
        "Name": "buildx",
        "Path": "/usr/libexec/docker/cli-plugins/docker-buildx"
      },
      {
        "SchemaVersion": "0.1.0",
        "Vendor": "Docker Inc.",
        "Version": "v2.3.1",
        "ShortDescription": "Docker Compose",
        "Name": "compose",
        "Path": "/usr/libexec/docker/cli-plugins/docker-compose"
      },
      {
        "SchemaVersion": "0.1.0",
        "Vendor": "Docker Inc.",
        "Version": "v0.8.0",
        "ShortDescription": "Docker Scan",
        "Name": "scan",
        "Path": "/usr/libexec/docker/cli-plugins/docker-scan"
      }
    ]

Signed-off-by: Sebastiaan van Stijn <[email protected]>
This removes the "require" docker-ce-cli, so that the package can be installed
stand-alone (withouth the docker cli itself installed).

Unlike "deb" packages, rpm package do not have "soft" requirement ("enhances",
"recommends"), so having a "requires" makes the docker-cli a hard requirement.

While in most situations, the plugin would be installed together with the docker
cli, the plugin _is_ able to run standalone:

    /usr/libexec/docker/cli-plugins/docker-compose up
    [+] Running 2/2
     ⠿ Network test_default  Created                         4.3s
     ⠿ Container test_web_1  Started                         2.1s
    Attaching to web_1
    web_1  | 10-listen-on-ipv6-by-default.sh: Getting the checksum of /etc/nginx/conf.d/default.conf
    web_1  | 10-listen-on-ipv6-by-default.sh: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
    web_1  | /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
    web_1  | /docker-entrypoint.sh: Configuration complete; ready for start up

This removes the "Requires" annotation from the package, to simplify the dependency
graph, and to allow installing the package separately (which could be for testing
purposes, or for a minimal install).

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah thaJeztah merged commit 71099ea into docker:master Mar 8, 2022
@thaJeztah thaJeztah deleted the add_compose_cli_package branch March 8, 2022 17:54
thaJeztah pushed a commit to thaJeztah/docker-ce-packaging that referenced this pull request May 19, 2022
[ce-nightly] Always use test channel when installing containerd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants