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

Provide a way to download only the docker-cli #2281

Open
DanielHabenicht opened this issue Jan 23, 2020 · 43 comments
Open

Provide a way to download only the docker-cli #2281

DanielHabenicht opened this issue Jan 23, 2020 · 43 comments

Comments

@DanielHabenicht
Copy link

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

This comment has been minimized.

@kirkone
Copy link

kirkone commented Jan 23, 2020

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.

@thaJeztah
Copy link
Member

thaJeztah commented Jan 23, 2020

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
Copy link
Member

thaJeztah commented Jan 23, 2020

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 😅

@DanielHabenicht
Copy link
Author

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)

@thaJeztah
Copy link
Member

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

@DanielHabenicht
Copy link
Author

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

@Yivan
Copy link

Yivan commented Mar 1, 2020

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

@Trolldemorted
Copy link

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

@thaJeztah
Copy link
Member

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

@Dennis-Petrov
Copy link

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?

@ad22
Copy link

ad22 commented Dec 5, 2020

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

@MarkMWright
Copy link

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.

@rlakey
Copy link

rlakey commented Feb 11, 2021

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.

@lixaotec
Copy link

lixaotec commented Mar 1, 2021

+1

@mstein-ck
Copy link

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.

@ChristoWolf
Copy link

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?

@lixaotec
Copy link

what is this?

@DanielHabenicht
Copy link
Author

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?

@thaJeztah
Copy link
Member

@DanielHabenicht what exactly do you want to download?

@DanielHabenicht
Copy link
Author

DanielHabenicht commented Oct 20, 2021

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.

@StefanScherer
Copy link
Member

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

@schindld
Copy link

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

@isanych
Copy link

isanych commented Oct 25, 2021

I use wsl2 and and install docker for linux there

@schindld
Copy link

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?

@thaJeztah
Copy link
Member

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 #3223, #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.

@lixaotec
Copy link

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

@thaJeztah
Copy link
Member

@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 #2281 (comment)

@lixaotec
Copy link

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

@Jose-Matsuda
Copy link

Jose-Matsuda commented Mar 16, 2022

@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

@thaJeztah
Copy link
Member

Yes, the CLI itself does not pull images; if you only need the image itself, you can pull the image data with (e.g.) some bash script; https://github.com/moby/moby/blob/v20.10.13/contrib/download-frozen-image-v2.sh (which saves the image configuration and layers), or (I think it supports this as well), a tool like https://github.com/regclient/regclient

@ByeBug
Copy link

ByeBug commented Dec 22, 2022

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

Totally agree. My IDE on Windows and docker daemon on a Linux VM. Maybe docker-cli can be like kubectl?

@ayush12993
Copy link

ayush12993 commented Apr 26, 2023

Install docker cli /docker client-

  1. Install Chocolatey from this website-
    https://chocolatey.org/install
    Run this command in Powershell / CMD as an Administrator

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

To check version

choco --v

  1. Run this command to install docker

choco install docker-cli

@ChristoWolf
Copy link

@ayush12993: That package is deprecated.
Instead, this should be used, it seems.
But I am not sure how official this is, although @StefanScherer is maintaining it.

@nikhilpurwant
Copy link

You can use this docker official link to download the docker client. It provides both docker daemon/server and cli binaries for Windows, MacOS and Linux. I have tried using the windows client downloaded from here (part of the official link above) with a remote Docker installation (within minikube) and it works fine. Also you can install buildx for latest container image building experience in case you get a legacy builder warning / error from here.

@ayush12993
Copy link

ayush12993 commented Aug 3, 2023

As latest it worked for me....
Type in CMD and find this -

Turn Windows Features ON/OFF

Enable Both

Virtual Machine Platform

Windows Hyperviser Platform

Restart it

Download from here --
https://download.docker.com/win/static/stable/x86_64/

Run below commands on powershell as admin

Expand-Archive /path/to/<FILE>.zip -DestinationPath $Env:ProgramFiles


&$Env:ProgramFiles\Docker\dockerd --register-service



Start-Service docker

&$Env:ProgramFiles\Docker\docker run hello-world:nanoserver

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12


Start-BitsTransfer -Source "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-windows-x86_64.exe" -Destination $Env:ProgramFiles\Docker\docker-compose.exe

@redliu312
Copy link

having the same requirement to only install docker cli in a container and using socat to using another docker backend
I make a poc based on the suggestions found in this thread. Thank u guys.

https://github.com/redliu312/d_in_d_using_socat

@ansilhk
Copy link

ansilhk commented Feb 7, 2024

There is no way to verify files downloaded from https://download.docker.com/.
It would be helpful to have checksum and signature along with the artifacts.

@trymeouteh
Copy link

trymeouteh commented Apr 20, 2024

I do not want to install Docker Desktop since it is closed source proprietary software

I do want to install Docker CLI on Linux, however it is hard to do with the instructions on the website and the docker.io package in the Debian/Ubuntu package repository are outdated.

It would be nice to have a simple DEB file that you can download to install Docker CLI on most or all Debian and Ubuntu based distributions and to have these DEB file also setup a 3rd party repository when you install Docker CLI to receive updates for Docker CLI

@thaJeztah
Copy link
Member

It would be nice to have a simple DEB file that you can download to install Docker CLI on most or all Debian and Ubuntu based distributions and to have these DEB file also setup a 3rd party repository when you install Docker CLI to receive updates for Docker CLI

Such packages already exist; for example, here's the packages for Ubuntu 22.04 ("jammy") for x86; https://download.docker.com/linux/ubuntu/dists/jammy/pool/stable/amd64/

That package repository has separate packages for containerd.io, the docker engine (docker-ce), the CLI (docker-ce-cli), as well as the CLI components for buildx and compose (docker-buildx-plugin and docker-compose-plugin); if you have the repository configured on your machine (see "set up the docker apt repository"). The instructions there show how to install all the components (both the engine, containerd, and CLI), but you can apt-install packages individually, and find what versions are available using apt's tooling (e.g. apt-cache madison);

apt-cache madison docker-ce-cli | head -n2
docker-ce-cli | 5:26.0.2-1~ubuntu.22.04~jammy | https://download.docker.com/linux/ubuntu jammy/stable arm64 Packages
docker-ce-cli | 5:26.0.1-1~ubuntu.22.04~jammy | https://download.docker.com/linux/ubuntu jammy/stable arm64 Packages

apt-cache madison docker-buildx-plugin | head -n2
docker-buildx-plugin | 0.14.0-1~ubuntu.22.04~jammy | https://download.docker.com/linux/ubuntu jammy/stable arm64 Packages
docker-buildx-plugin | 0.13.1-1~ubuntu.22.04~jammy | https://download.docker.com/linux/ubuntu jammy/stable arm64 Packages

apt-cache madison docker-compose-plugin | head -n2
docker-compose-plugin | 2.26.1-1~ubuntu.22.04~jammy | https://download.docker.com/linux/ubuntu jammy/stable arm64 Packages
docker-compose-plugin | 2.25.0-1~ubuntu.22.04~jammy | https://download.docker.com/linux/ubuntu jammy/stable arm64 Packages

But of course you can download individual deb packages manually (from download.docker.com)

@orf
Copy link

orf commented Jan 10, 2025

But of course you can download individual deb packages manually (from download.docker.com)

Can't you just publish these as Github releases? That way it works with a larger ecosystem of tools. How do I use the Docker CLI with mise? It's currently impossible.

@vvoland
Copy link
Collaborator

vvoland commented Jan 10, 2025

I don't think we can do that with our current release pipeline.

Btw, you can also obtain a cli binary from the dockereng/cli-bin image published by this repository CI.

For example, you can download the latest 27.4.1 release to <OUT-DIR> with:

echo 'FROM dockereng/cli-bin:27.4.1' | docker build --platform local -o <OUT-DIR> -
# or use the :latest tag
echo 'FROM dockereng/cli-bin:latest' | docker build --platform local -o <OUT-DIR> -

You can also download a bleeding-edge build off master branch:

echo 'FROM dockereng/cli-bin:master' | docker build --platform local -o <OUT-DIR> -

The image contains only a single docker static binary.

@orf
Copy link

orf commented Jan 10, 2025

I feel like there are a number of ways to do this, you could for example:

  1. add the above as a GitHub actions step and publish the outputs as release artefacts
  2. sync the contents of the release from download.docker.com to an artefact

The binaries available from download.docker.com are perfect content-wise, but they don't follow a normal {name}-{target} format and are distributed through a specific URL with no API, which makes it hard to automate.

GitHub releases gives you an API for distributing these binaries that existing ecosystem tools integrate with.

For example, with mise, I'd like to run mise install aqua:docker/cli@1.3.8 to get some specific version of the CLI that is consistent across all developer machines and CI/CD runs.

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

No branches or pull requests