cli icon indicating copy to clipboard operation
cli copied to clipboard

Provide a way to download only the docker-cli

Open DanielHabenicht opened this issue 5 years ago • 40 comments

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

DanielHabenicht avatar Jan 23 '20 13:01 DanielHabenicht

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

DanielHabenicht avatar Jan 23 '20 13:01 DanielHabenicht

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.

kirkone avatar Jan 23 '20 13:01 kirkone

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:20.10 /usr/local/bin/docker /usr/local/bin/

The above will pull the official docker:20.10 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=20.10

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

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

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

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

thaJeztah avatar Jan 23 '20 15:01 thaJeztah

~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 😅

thaJeztah avatar Jan 23 '20 16:01 thaJeztah

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)

DanielHabenicht avatar Jan 23 '20 16:01 DanielHabenicht

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 😅)

thaJeztah avatar Jan 23 '20 17:01 thaJeztah

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

DanielHabenicht avatar Jan 23 '20 17:01 DanielHabenicht

@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.

Yivan avatar Mar 01 '20 15:03 Yivan

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

Trolldemorted avatar Mar 04 '20 14:03 Trolldemorted

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

thaJeztah avatar Mar 04 '20 14:03 thaJeztah

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?

Dennis-Petrov avatar Nov 20 '20 11:11 Dennis-Petrov

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

ad22 avatar Dec 05 '20 20:12 ad22

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.

MarkMWright avatar Dec 22 '20 10:12 MarkMWright

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.

rlakey avatar Feb 11 '21 14:02 rlakey

+1

lixaotec avatar Mar 01 '21 17:03 lixaotec

I was hoping something like this was available. I'm running my application on AWS lambda with docker and I just need the CLI for windows so the VS tools for AWS can package my app. Is there a work-around to publish without installing the daemon.

mstein-ck avatar Apr 16 '21 16:04 mstein-ck

I would also love if the Docker CLI binary was simply provided by this repo (e.g. under Packages). For now, what about this though?

ChristoWolf avatar Aug 27 '21 10:08 ChristoWolf

what is this?

lixaotec avatar Aug 27 '21 11:08 lixaotec

With the latest license change this issue gets more relevant for people who won't be able to use Docker Desktop. Are there any updates @thaJeztah?

DanielHabenicht avatar Oct 20 '21 10:10 DanielHabenicht

@DanielHabenicht what exactly do you want to download?

  • Mac CLI binaries are available at https://download.docker.com/mac/static/stable/
  • Windows CLI (and daemon) binaries at https://download.docker.com/win/
  • Linux CLI packages are available for each distro as docker-cli (deb and rpm) packages; https://download.docker.com/linux/ubuntu/dists/focal/pool/stable/amd64/

thaJeztah avatar Oct 20 '21 14:10 thaJeztah

Great so the issue is almost resolved!

I would pledge for making the information you just posted more readily available. As a simple search for "docker cli download" only shows the Get Docker Page and this issue.

How about Linking them on the Docker Page and also adding the link to each version to the Github Release of this Repository? I am happy to provide a PR for the latter (github actions worflow?). For the start linking them on the README would be fine as well.

DanielHabenicht avatar Oct 20 '21 15:10 DanielHabenicht

We added this chapter to our docs recently: https://docs.docker.com/engine/install/binaries/#install-server-and-client-binaries-on-windows

StefanScherer avatar Oct 20 '21 16:10 StefanScherer

For Windows, this will get docker and docker-compose installed, but only for Windows containers.

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
choco install docker-engine docker-cli docker-compose -force
dockerd --register-service
Start-Service docker

How would one go about setting it to linux engine mode (I'm guessing a linux VM would be needed too).

schindld avatar Oct 25 '21 20:10 schindld

I use wsl2 and and install docker for linux there

isanych avatar Oct 25 '21 20:10 isanych

Fair, but for those of us working on managed computers that have WSL blocked, is there a dockerd switch to tell it to handle Linux containers? Our do we need to run a Linux VM and point Windows' docker to it somehow?

schindld avatar Oct 25 '21 22:10 schindld

is there a dockerd switch to tell it to handle Linux containers?

No, there isn't. Well, on docker 20.10 and older, to some extend there is, through LCOW ("Linux Containers On Windows"), but it's an experimental feature that was only partially implemented by Microsoft as a PoC, but it's being removed as it was no longer maintained, and has many known issues/limitations (see https://github.com/docker/cli/pull/3223, https://github.com/docker/cli/pull/2798, and issues linked from that).

Providing Linux support is (among others) what Docker Desktop provides, which can use either WSL2 or Hyper-V. To set this up without Docker Desktop would either require setting up a Docker Engine in WSL2 or a VM (wiring up networking, host-file sharing, and many other bits, if you want it to be usable from your Windows environment), or running a remote Docker Engine (e.g. in a cloud provider), and connecting the CLI to that instance, but this would not facilitate sharing your Windows filesystem out of the box.

thaJeztah avatar Oct 26 '21 12:10 thaJeztah

I wish to download only from docker hub images to .tar without install the entire docker engine, is that possible?

lixaotec avatar Jan 11 '22 11:01 lixaotec

@lixaotec do you want the cli binary inside a docker image, or on your host? If you need it inside a docker image, look at https://github.com/docker/cli/issues/2281#issuecomment-577745894

thaJeztah avatar Jan 11 '22 14:01 thaJeztah

Dear @thaJeztah , tks for replying. No I was wondering to download and save the image from Docker Hub. However I found that it is not possible. Even running only dockerd and docker cli from Windows environment, when i ask to Save the pulled image, docker claims it wont find Kernel... Other tricks are based on unofficial scripts to download it, which i wish not. thanks anyway. Will wait for some day DockerHub provides a 'Download' button without the need to use docker engine

lixaotec avatar Jan 11 '22 14:01 lixaotec

@thaJeztah ~Would you know if it's possible to to just pull an image from say dockerhub with just the CLI? When I try a minimal example using your comment from 2020 I get the following~ image

~For context I'm looking to just initiate a docker pull inside a container (to trigger some vulnerability scans on an image) and then once it gets to actually pulling it I'll stop the process, I don't need to actually do anything with the image I just need to initiate the pull. I'd like this without going full Docker in Docker.~

Just do this docker run -v /var/run/docker.sock:/var/run/docker.sock

Jose-Matsuda avatar Mar 16 '22 19:03 Jose-Matsuda