Step-By-Step Docker Installation on Windows and Linux
December 5, 2024Docker is a platform-as-a-service (PaaS) solution that leverages OS-level virtualization to deliver software packaged as containers. These containers enable applications to run consistently and efficiently across different environments. Docker provides both free and premium service tiers, with its core container-hosting software known as Docker Engine. First released in 2013, Docker is developed and maintained by Docker, Inc.
As a tool, Docker automates the deployment of applications within lightweight containers, ensuring isolated and seamless operation across various environments.
Install Docker Desktop on Windows
Install interactively
- Download the installer using the download button at the top of the page, or from the release notes.
- Double-click
Docker Desktop Installer.exe
to run the installer. By default, Docker Desktop is installed atC:\Program Files\Docker\Docker
. - When prompted, ensure the Use WSL 2 instead of Hyper-V option on the Configuration page is selected or not depending on your choice of backend.
If your system only supports one of the two options, you won’t be able to select which backend to use.
- Follow the instructions on the installation wizard to authorize the installer and proceed with the install.
- When the installation is successful, select Close to complete the installation process.
- Start Docker Desktop.
If your administrator account is different to your user account, you must add the user to the docker-users group:
- Run Computer Management as an administrator.
- Navigate to Local Users and Groups > Groups > docker-users.
- Right-click to add the user to the group.
- Sign out and sign back in for the changes to take effect.
Install from the command line
After downloading Docker Desktop Installer.exe
, run the following command in a terminal to install Docker Desktop:
$ "Docker Desktop Installer.exe" install
If you’re using PowerShell you should run it as:
Start-Process 'Docker Desktop Installer.exe' -Wait install
If using the Windows Command Prompt:
start /w "" "Docker Desktop Installer.exe" install
By default, Docker Desktop is installed at C:\Program Files\Docker\Docker
.
The install
command accepts the following flags:
--quiet
: Suppresses information output when running the installer--accept-license
: Accepts the Docker Subscription Service Agreement now, rather than requiring it to be accepted when the application is first run--no-windows-containers
: Disables the Windows containers integration--allowed-org=<org name>
: Requires the user to sign in and be part of the specified Docker Hub organization when running the application--backend=<backend name>
: Selects the default backend to use for Docker Desktop,hyper-v
,windows
orwsl-2
(default)--installation-dir=<path>
: Changes the default installation location (C:\Program Files\Docker\Docker
)--admin-settings
: Automatically creates anadmin-settings.json
file which is used by admins to control certain Docker Desktop settings on client machines within their organization. For more information, see Settings Management.- It must be used together with the
--allowed-org=<org name>
flag. - For example:
--allowed-org=<org name> --admin-settings="{'configurationFileVersion': 2, 'enhancedContainerIsolation': {'value': true, 'locked': false}}"
- It must be used together with the
--proxy-http-mode=<mode>
: Sets the HTTP Proxy mode,system
(default) ormanual
--override-proxy-http=<URL>
: Sets the URL of the HTTP proxy that must be used for outgoing HTTP requests, requires--proxy-http-mode
to bemanual
--override-proxy-https=<URL>
: Sets the URL of the HTTP proxy that must be used for outgoing HTTPS requests, requires--proxy-http-mode
to bemanual
--override-proxy-exclude=<hosts/domains>
: Bypasses proxy settings for the hosts and domains. Uses a comma-separated list.--proxy-enable-kerberosntlm
: Enables Kerberos and NTLM proxy authentication. If you are enabling this, ensure your proxy server is properly configured for Kerberos/NTLM authentication. Available with Docker Desktop 4.32 and later.--hyper-v-default-data-root=<path>
: Specifies the default location for the Hyper-V VM disk.--windows-containers-default-data-root=<path>
: Specifies the default location for the Windows containers.--wsl-default-data-root=<path>
: Specifies the default location for the WSL distribution disk.--always-run-service
: After installation completes, startscom.docker.service
and sets the service startup type to Automatic. This circumvents the need for administrator privileges, which are otherwise necessary to startcom.docker.service
.com.docker.service
is required by Windows containers and Hyper-V backend.- If your admin account is different to your user account, you must add the user to the docker-users group:
$ net localgroup docker-users <user> /add
Start Docker Desktop
Docker Desktop does not start automatically after installation. To start Docker Desktop:
- Search for Docker, and select Docker Desktop in the search results.
- The Docker menu ( ) displays the Docker Subscription Service Agreement.
Here’s a summary of the key points:
- Docker Desktop is free for small businesses (fewer than 250 employees AND less than $10 million in annual revenue), personal use, education, and non-commercial open source projects.
- Otherwise, it requires a paid subscription for professional use.
- Paid subscriptions are also required for government entities.
- The Docker Pro, Team, and Business subscriptions include commercial use of Docker Desktop.
- Select Accept to continue. Docker Desktop starts after you accept the terms.
Note that Docker Desktop won’t run if you do not agree to the terms. You can choose to accept the terms at a later date by opening Docker Desktop.
Install Docker Desktop on Linux
To install Docker Desktop successfully, your Linux host must meet the following general requirements:
- 64-bit kernel and CPU support for virtualization.
- KVM virtualization support. Follow the KVM virtualization support instructions to check if the KVM kernel modules are enabled and how to provide access to the KVM device.
- QEMU must be version 5.2 or later. We recommend upgrading to the latest version.
- systemd init system.
- Gnome, KDE, or MATE Desktop environment.
- For many Linux distributions, the Gnome environment does not support tray icons. To add support for tray icons, you need to install a Gnome extension. For example, AppIndicator.
- At least 4 GB of RAM.
- Enable configuring ID mapping in user namespaces, see File sharing. Note that for Docker Desktop version 4.35 and later, this is not required anymore.
- Recommended: Initialize
pass
for credentials management.
KVM virtualization support
Docker Desktop runs a VM that requires KVM support.
The kvm
module should load automatically if the host has virtualization support. To load the module manually, run:
$ modprobe kvm
Depending on the processor of the host machine, the corresponding module must be loaded:
$ modprobe kvm_intel # Intel processors
$ modprobe kvm_amd # AMD processors
If the above commands fail, you can view the diagnostics by running:
$ kvm-ok
To check if the KVM modules are enabled, run:
$ lsmod | grep kvm
kvm_amd 167936 0
ccp 126976 1 kvm_amd
kvm 1089536 1 kvm_amd
irqbypass 16384 1 kvm
Set up KVM device user permissions
To check ownership of /dev/kvm
, run :
$ ls -al /dev/kvm
Add your user to the kvm group in order to access the kvm device:
$ sudo usermod -aG kvm $USER
Sign out and sign back in so that your group membership is re-evaluated.