How to Install Docker on Windows, Linux, and macOS
Below are step-by-step instructions for installing Docker on each OS, along with links to official documentation for further help.
1. Docker Installation on Windows
-
Download Docker Desktop:
- Go to the official Docker Desktop for Windows download page.
- Download the installer.
-
Run the Installer:
- Run the downloaded
.exe
file and follow the on-screen instructions. - During installation, select whether to use WSL 2 or Hyper-V as the backend (WSL 2 is recommended if you’re on Windows 10 version 1903 or higher).
- Run the downloaded
-
Complete the Installation:
- After installation, open Docker Desktop and go through the setup wizard to finalize settings.
- Docker will automatically configure to start on boot. You may also enable Kubernetes if you need it.
-
Verify the Installation:
- Open a terminal (PowerShell or Command Prompt) and run the command:
docker --version
- You should see the Docker version number if the installation was successful.
- Open a terminal (PowerShell or Command Prompt) and run the command:
-
Additional Information:
- For advanced setup and troubleshooting, see Docker's Windows documentation.
2. Docker Installation on Linux
Docker is available on most Linux distributions. Here's a general guide, with specifics for Ubuntu as an example.
-
Update Package Index:
- Open your terminal and update the package list.
sudo apt-get update
- Open your terminal and update the package list.
-
Install Required Packages:
- Install necessary prerequisites to allow apt to use repositories over HTTPS:
sudo apt-get install \ ca-certificates \ curl \ gnupg \ lsb-release
- Install necessary prerequisites to allow apt to use repositories over HTTPS:
-
Add Docker’s Official GPG Key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
-
Set Up the Repository:
echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
-
Install Docker Engine:
sudo apt-get update sudo apt-get install docker-ce docker-ce-cli containerd.io
-
Start Docker:
- Start the Docker service:
sudo systemctl start docker
- Enable Docker to start on boot:
sudo systemctl enable docker
- Start the Docker service:
-
Verify the Installation:
docker --version
-
Further Information:
- For more on Docker installation on various Linux distros, check the Docker Linux documentation.
3. Docker Installation on macOS
-
Download Docker Desktop for macOS:
- Visit the Docker Desktop for Mac download page.
- Download the
.dmg
file.
-
Install Docker Desktop:
- Open the
.dmg
file and drag the Docker icon to the Applications folder. - Open Docker from Applications, which will start the installation process.
- Open the
-
Follow the Setup Wizard:
- Go through any initial configuration setup, and Docker Desktop should start automatically after the installation.
-
Verify the Installation:
- Open a terminal and run:
docker --version
- If the version number displays, your installation was successful.
- Open a terminal and run:
-
Additional Information:
- The Docker Desktop for macOS documentation has more details for macOS users.
With Docker installed, you can start building, sharing, and running containerized applications across any environment! Let us know if you have questions or need additional help.