Cli: Provide a way to download only the docker-cli

Created on 23 Jan 2020  路  15Comments  路  Source: docker/cli

Description

Steps to reproduce the issue:

  1. Have the need to only install the cli, because the docker host is somewhere else.
  2. Try to install only the docker-cli. But the main distribution always comes with the daemon and there are various workaround to install only the cli. (see below)

Describe the results you received:
It is not possible to simply download and execute the docker-cli somewhere.

Describe the results you expected:
A simple download link to each version of the docker-cli released, or bundled with the main docker release (https://www.docker.com/products/docker-desktop).

Additional information you deem important (e.g. issue happens only occasionally):

This Stackoverflow describes various workarounds, in short:

  • Extracting it from the installer
  • using chocolatey (complex solution if minimizing docker images)
  • using some magic links
kinfeature

Most helpful comment

For linux, the CLI and Engine (daemon) are separate packages nowadays, so you can install just the docker-ce-cli package; e.g. here's the packages for Ubuntu Xenial; https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/

If you want to use add the cli to an image you're building, there's an easy way to do this in your Dockerfile:

FROM <your base image>
COPY --from=docker:19.03 /usr/local/bin/docker /usr/local/bin/

The above will pull the official docker:19.03 image from Docker hub, and copy the docker CLI from it to your image.

If you want to be able to specify the version to install at build time, you can use a build-arg. For example:

ARG DOCKER_VERSION=19.03

# create an "alias" because COPY --from does not support expanding variables
FROM docker:${DOCKER_VERSION} AS docker

FROM ubuntu:16.04
COPY --from=docker /usr/local/bin/docker /usr/local/bin/

Then to override the default version, (e.g. to install the docker 18.09 cli);

docker build -t foo --build-arg DOCKER_VERSION=18.09 .

All 15 comments

Just for info, there is another opensource Repo mirroring this repo, which provides the cli for chocolatey

thanks to @StefanScherer and his work on https://github.com/StefanScherer/docker-cli-builder/ there is a way to get the file, but in my opinion there should be an official way to get this.

For linux, the CLI and Engine (daemon) are separate packages nowadays, so you can install just the docker-ce-cli package; e.g. here's the packages for Ubuntu Xenial; https://download.docker.com/linux/ubuntu/dists/xenial/pool/stable/amd64/

If you want to use add the cli to an image you're building, there's an easy way to do this in your Dockerfile:

FROM <your base image>
COPY --from=docker:19.03 /usr/local/bin/docker /usr/local/bin/

The above will pull the official docker:19.03 image from Docker hub, and copy the docker CLI from it to your image.

If you want to be able to specify the version to install at build time, you can use a build-arg. For example:

ARG DOCKER_VERSION=19.03

# create an "alias" because COPY --from does not support expanding variables
FROM docker:${DOCKER_VERSION} AS docker

FROM ubuntu:16.04
COPY --from=docker /usr/local/bin/docker /usr/local/bin/

Then to override the default version, (e.g. to install the docker 18.09 cli);

docker build -t foo --build-arg DOCKER_VERSION=18.09 .

~I think the above should work on Windows as well (COPY --from) but of course with modified paths (docker.exe instead of docker)~

edit: ignore this, there's no images for windows 馃槄

Thanks for your answer @thaJeztah! That covers the docker use case. But if I am working on a normal VM or PC I can't just copy if from the docker image. So there still is no easy way to just download the CLI.

As a side note, there seems to be an easy way to get the CLI (in Linux and Mac, but not for Windows)

Yes, the Windows binaries were no longer published at some point, because for Windows only Docker for Windows ("Docker Desktop"), for desktop machines, and Docker Enterprise (for Windows Server) were supported.

Changing that (and at least publish _client_ binaries again) is being discussed, but no decision was made yet. You can find "master" builds on https://master.dockerproject.org (but that location is being deprecated, which is where the discussion about this comes in 馃槄)

Well, then you can use this issue for tracking progress on it :)
Please keep us updated, thanks!

@DanielHabenicht @thaJeztah Thanks for taking in interest this issue.
I really hope too official cli bianaries for Windows will be available soon.
https://github.com/StefanScherer/docker-cli-builder/releases is not more uptodate and having official binaries will be better (enterprise security/rules).

I should add that there is a following trends using VSCode, and the recent remote developper tools which solves really some big problems on Windows (like abilities to work directly in containers on Windows without having to use the so slow Docker for Windows sharing folder ; )). The only downside is vscode remote containers need a docker client installed... So I am here : ) For now we extract it from the full Docker binaries, but this is painfull for a developper team.
Ideal would be: just install vscode, docker client, start the VM and enjoy full docker linux experience on Windows with the IDE : )

I hope my experience return make sense, and i think having separated cli is more and more needed for the days to come.

Thanks.

@thaJeztah are there any news about that decision, and more importantly, will you also release a docker-compose?

Last I heard is that discussions around Windows packages are still ongoing (think some legal and/or partner things to tackle).

As to packages for docker-compose; no change of plan there (afaik); docker-compose is shipped as part of Docker Desktop, and builds for releases can be found on GitHub; https://github.com/docker/compose/releases

Our team builds docker images during build process on build server. Build server is running Windows Server OS, and the Docker host is running Ubuntu. Both are virtual machines, To use Docker CLI from build server, we have to apply workarounds posted at Stackoverflow page mentioned above.

Why just don't provide an installer option "Install Docker CLI only" for Docker Desktop?

I used the chocolatey package docker-cli in a windows docker container to access the docker daemon on the host (DIND). It seems to work well.
https://chocolatey.org/packages/docker-cli

Would really really really appreciate a windows CLI install (by whatever method) of Docker, as we are unable to run the daemon on windows due to security constraints.

Was looking for a Windows CLI only install today as well and was surprised to find there is none. Would be great to have this...just need to run some commands from a windows box.

+1

Was this page helpful?
0 / 5 - 0 ratings