Skip to content

Control Docker Desktop via CLI #172

Open

Description

@stephen-turner

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.

Activity

  1. added
    docker_desktop
    on Nov 18, 2020
  2. myitcv commented on Nov 18, 2020

    @myitcv
  3. richard-mauri commented on Apr 27, 2021

    @richard-mauri

    +1

  4. kevin-lindsay-1 commented on May 22, 2021

    @kevin-lindsay-1

    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.

  5. rfay commented on May 6, 2022

    @rfay

    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.

  6. violen commented on Oct 13, 2022

    @violen

    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

  7. rfay commented on Jul 15, 2023

    @rfay

    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?

  8. sandipndev commented on Jan 23, 2024

    @sandipndev

    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.

  9. jpillor-macquarie commented on Feb 8, 2024

    @jpillor-macquarie

    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 😕

  10. self-assigned this
    on Feb 20, 2024
  11. KatTomrushka commented on Feb 20, 2024

    @KatTomrushka

    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.

  12. colinhemmings commented on Feb 20, 2024

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

  13. rfay commented on Feb 20, 2024

    @rfay

    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!

  14. thaJeztah commented on Feb 20, 2024

    @thaJeztah
    Member

    🙈 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 ...
  15. jpillor-macquarie commented on Feb 20, 2024

    @jpillor-macquarie

    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

  16. jpillor-macquarie commented on Feb 20, 2024

    @jpillor-macquarie

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

  17. moved this to Investigating in docker-roadmapon May 28, 2024
  18. removed their assignment
    on Sep 25, 2024
  19. seliquity commented on Nov 3, 2024

    @seliquity

    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?

  20. moved this from Investigating to Upcoming in docker-roadmapon Nov 4, 2024
  21. KatTomrushka commented on Nov 4, 2024

    @KatTomrushka

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

  22. ch-tstrickland commented on Nov 25, 2024

    @ch-tstrickland

    Please could you consider adding a feature like git config to allow us to get/set configuration for docker desktop. We currently alter the docker settings file using jq, but when we do so:

    1. We do not know that the file format will not change.
    2. Docker desktop complains that its settings file has been changed, which is alarming for users.
    3. Even the location of the settings file is not certain.

    A CLI contract would help here.
    Additionally, CLI start/ stop/ restart and access to the troubleshoot commands would be very helpful.

  23. ch-tstrickland commented on Dec 19, 2024

    @ch-tstrickland

    Loving the new start/stop/etc feature. Are you going to consider a config API? Should I ask in a separate ticket - or perhaps I've missed a preexisting ticket? Many thanks.

  24. moved this from Upcoming to Investigating in docker-roadmapon Feb 3, 2025
  25. joeykmh commented on Mar 20, 2025

    @joeykmh

    Resetting the kubernetes cluster via the docker desktop CLI would be extremely useful for our team. That is the one step of our local development flow that we cannot automate with docker desktop currently. It requires a manual step to open the UI and click the "reset" button.

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

Metadata

Metadata

Assignees

Labels

docker_desktop

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions