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

Control Docker Desktop via CLI #172

Open
stephen-turner opened this issue Nov 18, 2020 · 16 comments
Open

Control Docker Desktop via CLI #172

stephen-turner opened this issue Nov 18, 2020 · 16 comments
Assignees
Labels
docker_desktop Improvements or additions to Docker Desktop

Comments

@stephen-turner
Copy link

Tell us about your request
Most of the Docker Desktop settings are only available via the UI. Several users have commented that it would be useful to be able to control some of them via the CLI, in order to be able to script installation or running of Docker Desktop.

Which service(s) is this request for?
Docker Desktop

Are you currently working around the issue?
Editing the settings.json file works for settings, although not for operations such as Restart or Quit.

@myitcv
Copy link

myitcv commented Nov 18, 2020

Related context docker/for-mac#2359 (comment)

@richard-mauri
Copy link

+1

@kevin-lindsay-1
Copy link

Hey! Per docker/cli#3101 (comment), pasting this comment:


Right now, I don't see any command to reset the docker instance of kubernetes via the command line.

As a developer, part of my daily routine is to run a script that sets up my local cluster to a set starting point. I'm currently using Minikube on Mac, but I'd like to try DD for this, as minikube is a little extra complexity that I'm not sure is necessary for my team's needs.

In minikube, you pretty much just run minikube delete followed by minikube start to reset your cluster, whereas in DD it's a button in the UI; It would be really nice to make the button that resets the DD Kubernetes cluster a CLI command, preferably one that will wait until the reset is complete.

@rfay
Copy link

rfay commented May 6, 2022

This is really important for CI applications. docker/for-mac#2359 has a number of fragile ways to do this that people have been trying to hold together since the old way went away a year or two ago.

@violen
Copy link

violen commented Oct 13, 2022

Is there an update for this or the docker/for-mac/issues/2359 Issue?
I'm looking especially for an auto update mechanism. There is an official Guide to install via cli instead using brew here install-from-cli on MacOs

As far as I have been come I need to login to the headless machines and manually "accept & restart" Docker Desktop for Mac and I like this to happen automatically

@rfay
Copy link

rfay commented Jul 15, 2023

There's still no supported way to start Docker Desktop (Windows or mac) from the command line right? Even though there's now unattended install?

@sandipndev
Copy link

Having a way to start Docker Desktop from CLI would be a great win for the community. I can verify there are a bunch of users looking for this in their CI setup.

@jpillor-macquarie
Copy link

At our company, we'd also like to automate developer environments with Docker Desktop and this is a hurdle for us - currently we are forced to show prompts to user, directing them to click around the UI - not the best experience 😕

@KatTomrushka
Copy link
Collaborator

Could you kindly share which commands / settings, if made available through the CLI, would significantly enhance your operational efficiency?

The following seem to be on the shortlist so far:

  1. Restart Docker Desktop
  2. Quit Docker Desktop
  3. Reset Kubernetes Cluster

We value your input and are interested in understanding your preferences.

@colinhemmings
Copy link
Collaborator

I would find Open Docker Desktop Dashboard really valuable. It's annoying having to click the Go to Dashboard in the menu bar if I have previously closed the dashboard.

@rfay
Copy link

rfay commented Feb 20, 2024

The listed items are great. It's also easy to look at how well done the Rancher Desktop rdctl and the OrbStack orb commands are done. Both of those solve all the issues discussed here. Thanks for working on this!

@thaJeztah
Copy link
Member

thaJeztah commented Feb 20, 2024

🙈 I should probably post the output from the CLI that I cobbled together some Years ago for an internal hackathon; looks like it still somewhat works;

docker desktop command with some initial subcommands;

docker desktop --help

Usage:  docker desktop COMMAND

Commands to interact with Docker Desktop

Management Commands:
  dashboard   Control the Docker Desktop dashboard.
  diagnostics Gather and upload diagnostics bundles for Docker Desktop.

Commands:
  pause       Pause Docker Desktop.
  restart     Restart Docker Desktop.
  resume      Resume Docker Desktop.
  settings    Open Docker Desktop settings.
  shutdown    Stop Docker Desktop.
  start       Start Docker Desktop.

Run 'docker desktop COMMAND --help' for more information on a command.

docker desktop diagnostics to help discovering reporting issues / sending diagnostics;

docker desktop diagnostics --help

Usage:  docker desktop diagnostics COMMAND

Gather and upload diagnostics bundles for Docker Desktop.

Commands:
  check-login Verify HTTP authenticating to login.docker.com and proxy configuration.
  run         Run diagnostic and suggest a way to repair the failures.
  upload      Create and optionally upload a diagnostics bundle.

Run 'docker desktop diagnostics COMMAND --help' for more information on a command.

If Desktop is shutdown (not suspended);

docker ps -a
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

docker desktop start
Starting Docker Desktop ...

docker ps -a
CONTAINER ID   IMAGE             COMMAND                  CREATED        STATUS                    PORTS     NAMES
67451e904f48   docs/docstage     "/docker-entrypoint.…"   23 hours ago   Exited (0) 23 hours ago             dockergithubio-docs-1
04aef664a1ff   nginx:alpine      "/docker-entrypoint.…"   5 days ago     Exited (0) 2 hours ago    80/tcp    foo
d3e93ee0e491   docker/swarmkit   "make generate"          6 days ago     Exited (0) 6 days ago               laughing_mayer
d0e1fe510ef7   nginx:alpine      "/docker-entrypoint.…"   13 days ago    Exited (0) 2 hours ago              container_one
042ab952468a   busybox           "sh"                     13 days ago    Exited (0) 2 hours ago              pause_container

Some commands (TBD) to open the GUI from the command-line (e.g. open settings, open the dashboard), but settings could possibly also be managed from the command-line

docker desktop settings
Opening Docker Desktop settings...
docker desktop dashboard open
Opening Docker Desktop dashboard...
Dashboard was opened successfully

Restart and shutdown;

docker desktop restart
Restarting Docker Desktop ...
Docker Desktop was successfully restarted
docker desktop shutdown
Shutting down Docker Desktop ...
Docker Desktop was shut down successfully

Oh, and I had a version with some really (really!) hacky code to manage updates and install/uninstall (to go from a cli-only situation to desktop);

Usage:  docker desktop COMMAND

Commands to interact with Docker Desktop

Management Commands:
  dashboard   Control the Docker Desktop dashboard.
  diagnostics Gather and upload diagnostics bundles for Docker Desktop.
  update      Manage Docker Desktop software updates.

Commands:
  install     Install Docker Desktop.
  pause       Pause Docker Desktop.
  restart     Restart Docker Desktop.
  resume      Resume Docker Desktop.
  settings    Open Docker Desktop settings.
  shutdown    Stop Docker Desktop.
  start       Start Docker Desktop.
  uninstall   Uninstall Docker Desktop.

Run 'docker desktop COMMAND --help' for more information on a command.
docker desktop install
Installing Docker Desktop...
Successfully installed Docker Desktop 4.28 (build 138140)
Starting Docker Desktop ...
docker desktop uninstall
Shutting down Docker Desktop ...
Docker Desktop was shut down successfully
Uninstalling Docker Desktop...
Successfully uninstalled Docker Desktop

And some commands to manage updates;

docker desktop update --help

Usage:  docker desktop update COMMAND

Manage Docker Desktop software updates.

Commands:
  check       Check for Docker Desktop updates.
  download    Download Docker Desktop updates.
  install     Install Docker Desktop updates.

Run 'docker desktop update COMMAND --help' for more information on a command.

(but looks like those are broken, which doesn't surprise me 😂);

docker desktop update check
Checking if Docker Desktop updates are available ...

@jpillor-macquarie
Copy link

I would find Open Docker Desktop Dashboard really valuable. It's annoying having to click the Go to Dashboard in the menu bar if I have previously closed the dashboard.

@colinhemmings @KatTomrushka you can do this today, link or open URI docker-desktop://dashboard/open

@jpillor-macquarie
Copy link

Could you kindly share which commands / settings, if made available through the CLI, would significantly enhance your operational efficiency?

We automate pulls and other normal docker commands, however our SSO tokens have very short TTLs, so they often expire. This results in docker commands returning something like docker login to proceed, unfortunately docker login only works if you're logging into docker hub without SSO. In our case the error is more confusing because the user does it, and it doesn't fix it. The user actually needs to open docker desktop, and then click login, and then go through the SSO process.

As a partial step towards this, it'd be great if we could trigger login and take the user straight to the login screen.

This action, and any other actions, could be triggered via docker desktop plugin, or via local RPC endpoint (which the plugin would use), or via docker-desktop URIs - however these would offer the least functionality. A documented API endpoint would be preferred :)

@seliquity
Copy link

Is there honestly no way to restart Docker Desktop on Windows via CLI?

Mine has a weird bug where my containers just freeze after about 24-48 hours and I have to restart them, which I think is WSL related, but currently I have to do "wsl --shutdown" and then VNC in to click a "Restart" button on the modal that pops up, and it seems fairly ridiculous there doesn't appear to be an obvious way I can just restart the whole of Docker Desktop via a command or two without having to resort to that?

@KatTomrushka KatTomrushka moved this from Investigating to Upcoming in docker-roadmap Nov 4, 2024
@KatTomrushka
Copy link
Collaborator

Yes, @seliquity good point and restart is definitely included in the scope. Thanks for the feedback, keep it coming!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker_desktop Improvements or additions to Docker Desktop
Projects
Status: Upcoming
Development

No branches or pull requests