Docker Desktop version 4.37 and later introduces the Docker Desktop CLI, a powerful tool that allows developers to manage key Docker Desktop operations directly from the command line. This addition significantly enhances automation capabilities and streamlines the developer experience, particularly for those working with CI/CD pipelines.
In this blog, we’ll explore the Docker Desktop CLI, covering its key features and demonstrating how to use its commands effectively.
Getting Started
Ensure you have Docker Desktop version 4.37 or later installed to access the Docker Desktop CLI.
Checking the CLI version
PS C:Usersajeet>docker desktop version
Docker Desktop CLI version: v0.1.1
Listing the key Commands
Usage: docker desktop COMMAND
Docker Desktop commands (Beta)
Management Commands:
engine Manage Docker Desktop engine
module Manage Docker Desktop modules (Alpha)
Commands:
restart Restart Docker Desktop
start Start Docker Desktop
status Show the status of the Docker Desktop engines
stop Stop Docker Desktop
version Show the Docker Desktop version information
Management Commands
docker desktop engine --help
Usage: docker desktop engine COMMAND
Manage Docker Desktop engine
Commands:
ls List all supported engine modes
use Set the current Docker Desktop engine mode
Run 'docker desktop engine COMMAND --help' for more information on a command.
Below are the primary commands provided by the Docker Desktop CLI and their use cases.
Start Docker Desktop
Start Docker Desktop from the command line:
docker desktop start
This command initializes Docker Desktop, bringing the platform online for containerized application development.
Check the status
PS C:Usersajeet> docker desktop status
Name Value
Status running
SessionID 219544ec-00fe-4f47-9032-f48d7c520747
PS C:Usersajeet>
List all supported engine modes
PS C:Usersajeet> docker desktop engine ls
Name Description
linux * Linux engine
windows Windows engine
PS C:Usersajeet>
Switching the Engine
PS C:Usersajeet> docker desktop engine use windows
Current engine is now "windows"
Switch back to Linux
PS C:Usersajeet> docker desktop engine use linux
Current engine is now "linux"
Restart Docker Desktop
Restart Docker Desktop to refresh the environment or apply configuration changes:
docker desktop restart
This command is useful for troubleshooting or reloading Docker Desktop after updates.
Check Docker Desktop Status
Monitor the current status of Docker Desktop:
docker desktop status
This command outputs the operational state of Docker Desktop, such as whether it is running or stopped.
CLI to Manage Docker Desktop modules
docker desktop module
Usage: docker desktop module COMMAND
Manage Docker Desktop modules (Alpha)
Commands:
ls List modules
reset Reset all updated modules
update Update all modules
Run 'docker desktop module COMMAND --help' for more information on a command.
PS C:Usersajeet>
PS C:Usersajeet>
docker desktop module ls
ID TYPE LATEST VERSION CURRENT VERSION
ai cli-plugin v0.3.6 v0.5.13
compose cli-plugin v2.31.0-desktop.2 v2.32.2-desktop.1
desktop cli-plugin v0.1.1 v0.1.1
scout cli-plugin v1.16.1 v1.16.1
PS C:Usersajeet>
Update all the Docker Desktop Modules
docker desktop module update
✓ Checking module updates
✓ Everything is up to date
PS C:Usersajeet>
Stop Docker Desktop
Shut down Docker Desktop when not in use:
docker desktop stop
Conclusion
The Docker Desktop CLI empowers developers with more control and automation, making it an essential tool for modern containerized application workflows. Whether you’re optimizing CI/CD pipelines or enhancing your local development environment, these commands provide the flexibility and efficiency you need.
Upgrade to Docker Desktop 4.37 or later and start leveraging the Docker Desktop CLI today!
Source link
lol