How to Install Docker on Windows, Mac, and Linux

Installing Docker is a straightforward process that empowers you to streamline application deployment across Windows, MacOS, and various Linux distributions like Ubuntu and CentOS.
By leveraging Docker, you’re embarking on a journey to modernize your software environment with techniques like virtualization and containerization.
Docker’s compatibility with cloud infrastructure such as AWS and Google Cloud and its role in facilitating continuous integration and deployment make it an essential tool for efficient DevOps workflows.
Understanding how to set up Docker will help you manage your software environment and navigate the world of microservices seamlessly.
This guide will take you through key steps including system requirements, downloading Docker Desktop, and executing essential command line instructions.
By the end, you’ll be equipped to handle Docker configuration, troubleshoot common issues, and utilize associated tools like Docker Compose effectively. Whether you’re deploying on a virtual machine or leveraging the power of Kubernetes, this tutorial aims to be your comprehensive reference.
How To Install Docker: Quick Workflow
To install Docker on your system, follow the instructions based on your operating system: Windows or Linux.
Installing Docker on Windows
Download Docker Desktop
Visit the Docker Desktop download page and download the installer.Run the Installer
Double-click the downloadedDocker Desktop Installer.exe
file to start the installation process.Configuration Options
During installation, ensure to enable WSL 2 (Windows Subsystem for Linux) or Hyper-V, depending on your preference. Follow the prompts in the installation wizard.Complete Installation
Once the installation is complete, click Close to finish.Verify Installation
Open PowerShell and run the following commands to verify that Docker is installed correctly:docker --version
docker run hello-world
Installing Docker on Linux
For Ubuntu/Debian
Update Package Lists
Open a terminal and run:sudo apt update && sudo apt upgrade -y
Install Required Dependencies
Execute:sudo apt install -y ca-certificates curl gnupg
Add Docker Repository & Install Docker
Run these commands:curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
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
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io
Start and Enable Docker
Use:sudo systemctl start docker
sudo systemctl enable docker
Verify Installation
Check by running:docker --version
sudo docker run hello-world
For CentOS
Update Package Lists
Run:sudo yum update -y
Install Required Dependencies
Execute:sudo yum install -y yum-utils
Add Docker Repository & Install Docker
Use:sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo yum install -y docker-ce docker-ce-cli containerd.io
Start and Enable Docker
Run:sudo systemctl start docker
sudo systemctl enable docker
Verify Installation
Check with:docker --version
sudo docker run hello-world
Installing Docker on Linux

Supported Linux Distributions
Ubuntu, Debian, Fedora, RHEL, CentOS, and more are on the list. Docker is versatile, scales well with various environments. Whether you’re on a powerhouse server or a humble notebook, Docker’s architecture adapts.
Installing Docker on Ubuntu
Updating package lists and installing dependencies
First, ensure your packages are up-to-date. You will need a few dependencies to make Docker sing. Fire up the terminal:
sudo apt update && sudo apt install apt-transport-https ca-certificates curl software-properties-common
Adding the Docker GPG key and repository
Get that GPG key. It’s like adding a secret handshake between your system and Docker:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Now add the repo to your sources:
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
Installing Docker CE (Community Edition)
Update your package database, then install:
sudo apt update
sudo apt install docker-ce
Verifying installation and starting Docker
Check if everything’s in place:
sudo systemctl status docker
A green active status? You’re good to go.
Running Docker Without Sudo (Optional)
Creating and adding a user to the Docker group
Tired of sudo? Add your user to the Docker group:
sudo usermod -aG docker ${USER}
Log out and back in, or use su - ${USER}
.
Testing Docker without sudo permissions
Try running Docker:
docker run hello-world
If it works, you’re set. No more sudo warnings.
Installing Docker on Other Linux Distributions
Using binaries for manual installation
Sometimes, the package manager isn’t the hero you need. In those cases, a manual binary installation might just save the day. Download, extract, and install.
Considerations for distribution-specific package managers
Every Linux distribution likes doing things its way. Whether it’s yum, dnf, or zypper, knowing your distribution’s preferred package manager commands is crucial. Navigate their nuances to install Docker with ease.
Installing Docker on macOS

System Requirements
Supported macOS versions include both Intel and Apple Silicon. The software craves some specifics: at least 4GB RAM and 2GHz dual-core processor. MacBook or iMac, performance matters.
Interactive Installation via GUI
Downloading and launching Docker Desktop Installer
Off to get the installer package. Make sure it matches your Mac’s architecture. A quick visit to Docker Hub, and you’re downloading the latest and greatest.
Granting necessary permissions
Macs are cautious. Security prompts will pop, so let those permissions through. Your Mac is just looking out for you.
Accepting the Docker Subscription Agreement
Click away and accept the terms. There’s usually no escaping agreements on a fresh install.
Configuring recommended or advanced settings
Docker Desktop is flexible. Stick with defaults or dive into those advanced settings for a personal touch. Whatever floats your boat.
Command-Line Installation
Downloading the installer and mounting the disk image
For the minimalists out there, grab the installer via command-line. Use curl
or download directly in your favorite terminal:
curl -O https://desktop.docker.com/mac/stable/Docker.dmg
hdiutil attach Docker.dmg
Running installation commands
Drag and drop into Applications, but command-line enthusiasts might prefer:
sudo cp -R /Volumes/Docker/Docker.app /Applications
Accepting license agreements via command-line flags
Sometimes, silent installs are necessary. Agree with flags like:
open /Applications/Docker.app --args --accept-preview --unattended
Knowing your flags can smooth the path.
Verifying installation
Fire up Terminal:
docker --version
Installing Docker on Windows

System Requirements
Windows 10 or 11—Pro, Enterprise, or Education editions. These are your partners in Docker installation. Compatibility is a must for running Hyper-V, WSL 2, and Containers. Don’t forget to tweak those BIOS settings for hardware virtualization. It makes all the difference—a switch you can’t afford to ignore.
Step-by-Step Installation Process
Downloading Docker Desktop Installer
Visit Docker’s website. Grab that Docker Desktop Installer. It’s a small step that leads to big things. It’s fast. It’s easy. Get it onto your system.
Running the installer and enabling necessary Windows features
Run the installer. Windows will ask about enabling features like WSL 2. Accept them! You want Docker running smooth, without a hitch. Follow the prompts; they’re there to help.
Completing the installation and restarting the system
Installation wraps up. Sometimes a restart is all you need for everything to wind into place. Don’t skip this. Trust the reboot.
Installing from the Command Line
Using PowerShell, Command Prompt, or Windows Terminal
Feeling tech-savvy? You have options: PowerShell, Command Prompt, or Windows Terminal. Each can run the necessary commands. Yourself as the control tower. Download, mount, execute.
Adding users to the Docker group if needed
Docker privileges can be complex. If you’re prompted for user permissions, add yourself or others to the Docker group. Power is key.
Verifying installation and checking Docker version
Verification isn’t just for experts. Type:
docker --version
Post-Installation Setup and Configuration
Verifying Docker Installation
Running docker –version and docker info
Make sure Docker is alive and well. Crack open the terminal. Run:
docker --version
docker info
First command shows you’re on the right track. Second one dives deeper—insight into resources and settings.
Checking system-wide Docker configurations
Docker’s not shy. It broadcasts its configuration to all who inquire. Maybe you’ve customized settings—a peek here confirms if they stuck.
Configuring Docker for First Use
Setting up Docker to start on boot
Nobody likes restarting Docker every time. Set it to start automatically:
sudo systemctl enable docker
One less thing to worry about.
Managing permissions and user groups
Permissions can be tricky. Ensure you or your team have access without constant sudo. Add users to the Docker group for ease:
sudo usermod -aG docker yourusername
Adjusting network and storage settings
Network and storage might need a tweak. Check defaults fit your needs—whether running complex microservices or a simple container.
Understanding Docker CLI and Basic Commands
Syntax and structure of Docker commands
Docker enthusiasts, prepare for a command-line adventure. Commands are sleek:
docker [command] [options]
Master this structure, and Docker whispers its secrets effortlessly.
Running docker –help to explore subcommands
Don’t know where to start? Begin here:
docker --help
It’s your built-in guide. Each subcommand opens a world of possibilities and options.
Commonly used Docker commands
Shortcuts to effective Docker usage:
- docker run: Start your images, bring them to life.
- docker ps: Check what’s running, who’s active.
- docker stop: Halt a container that’s overstayed its welcome.
- docker rm: Clear out the old, make room for the new.
Working with Docker Images and Containers
Understanding Docker Images
What are Docker images?
Think of Docker images as the blueprint for your containers. They pack everything an app needs to run: code, configs, system tools. They’re the starting point for launching containers. Ingredients in a recipe.
Pulling images from Docker Hub
Docker Hub is a vast collection of pre-built images. To get one, execute:
docker pull imagename
Simple. Grab what you need.
Searching for images using docker search
Need a specific image or not sure what exists? Search with:
docker search keyword
Find the image that suits your project. A treasure trove, within reach.
Managing Docker Images
Listing available images
Inventory check. What images are on your system? Run:
docker images
Names, tags, sizes. All there.
Removing unused or outdated images
Clear the clutter. Space isn’t infinite. Use:
docker rmi imagename
docker image prune
Make room for new possibilities.
Running Docker Containers

Creating a container from an image
Spin up fresh from an image:
docker run imagename
A single line to create a living, breathing container.
Running interactive containers with -it flag
Need to interact? Try:
docker run -it imagename /bin/bash
Live session. Full control.
Stopping, restarting, and deleting containers
Control your running containers. Use these:
docker stop containername
docker restart containername
docker rm containername
Start, halt, repeat as needed.
Managing Running Containers
Listing running and stopped containers
See what’s on the go. Insight into uptime:
docker ps
docker ps -a
Check status. See both worlds: the active and the dormant.
Accessing container logs and real-time stats
Dive into past logs or current metrics:
docker logs containername
docker stats
Stay informed. Keep analysts close.
Using docker exec to run commands inside a container
Enter a world within a world. Run commands live inside your container:
docker exec -it containername command
Creating and Managing Custom Docker Images
Modifying and Saving Containers as Images
Making changes inside a running container
Inside a Docker container, you can alter the environment like a sandbox. Want to tweak configurations or install extra utilities? Spin up a container:
docker run -it imagename /bin/bash
Make those changes. Your container’s now your testbed.
Committing changes with docker commit
Satisfied with your tweaks? Lock them in by committing. Think of it as taking a snapshot:
docker commit containerid newimagename
Your modified Docker image becomes a repeatable resource.
Building Images Using Dockerfiles
Understanding Dockerfile structure
A Dockerfile is your recipe card. It defines each line used to build an image. Instructions are sequential and crucial. Everything starts with FROM
.
Writing a basic Dockerfile
Want simplicity? Start typical:
FROM alpine:latest
RUN apk add --no-cache python3
CMD ["python3"]
Three lines, functional image. Add layers of complexity as needed.
Building an image with docker build
Ready to see your Dockerfile in action? Craft your image:
docker build -t imagename .
This compiles every command into an executable package. Efficiency at its finest.
Pushing Images to Docker Hub
Logging into Docker Hub
Visibility demands accessibility. Want your image open to the world? First, log in:
docker login
Credentials connect your local system with the global Docker Hub.
Tagging images for repository upload
Before launching into the ether, tagging’s essential. It’s discipline; an identifier:
docker tag imagename username/imagename:tag
Be clear. No ambiguity allowed.
Using docker push to share images
Ready to unveil your creation? Push it:
docker push username/imagename:tag
Managing Docker on Different Systems
Starting and Stopping Docker Services
Using systemctl on Linux
Bringing Docker up or taking it down? Linux makes it straightforward:
sudo systemctl start docker
sudo systemctl stop docker
Adapt it with restart
or status
as needed. You’re in control.
Managing Docker services on macOS and Windows
Mac or PC, the process feels different but delivers the same. For macOS, productivity is a click in the Docker Desktop app. For Windows? Search “Docker” in your taskbar. Restarts, stops, and resumes—always just a click away.
Updating and Maintaining Docker
Checking for updates
Always chase the latest. Hit the terminal for Linux:
docker --version
sudo apt update
sudo apt upgrade docker-ce
macOS and Windows alert you when updates shine bright. Keep an eye out.
Upgrading Docker to the latest version
Updating is readiness:
sudo apt-get upgrade docker-ce
brew upgrade --cask docker
Keep your ecosystem current. Always tailored for Docker’s latest.
Handling automatic updates on macOS and Windows
Automatic updates demand less of you. Toggle settings on Docker Desktop. For Windows, everything is possible with a checkbox.
Uninstalling Docker
Removing Docker on Linux
Clean breaks matter too:
sudo apt-get purge docker-ce
sudo apt-get autoremove
The relics of yesterday, gone.
Uninstalling Docker Desktop on macOS and Windows
Drag to the trash on macOS. Hit “Uninstall” on Windows.
Cleaning up residual files and configurations
Last, let’s clean house:
rm -rf ~/.docker
FAQ on How To Install Docker
How do I install Docker on Windows?
To install Docker on Windows, first ensure that Hyper-V is enabled. Download Docker Desktop from the official website.
Launch the installer and follow the instructions, accepting the license agreement. Choose the required configuration options and click “Install.” After installation, restart your system for changes to take effect.
Can I install Docker on macOS?
Yes, you can install Docker on macOS. First, ensure you have macOS version 10.13 or newer. Download Docker Desktop for Mac from the Docker website.
Open the downloaded disk image and drag Docker to your Applications folder. Finally, double-click Docker to start the installation process and follow the setup wizard.
Which Linux distributions support Docker?
Docker supports multiple Linux distributions including Ubuntu, Fedora, CentOS, and Debian. For each, you typically add Docker’s official GPG key, set up the Docker repository, and then install Docker Engine using the package manager available in your chosen distribution.
What are the prerequisites for installing Docker?
Before installing Docker, ensure your system supports virtualization technology. For Windows, enable Hyper-V. On macOS, you need macOS 10.13 or later.
For Linux distributions, follow specific instructions for your distribution. Check your system has internet access to download installation files and updates.
Can Docker run on a virtual machine?
Yes, Docker runs on a virtual machine. However, you must ensure the VM has the necessary resources and virtualization support.
Docker’s performance might be limited in a VM compared to direct installation, but it’s a practical solution for situations requiring virtualized environments.
How do I troubleshoot Docker installation errors?
Start by checking the installation logs for errors. Ensure your system meets all the necessary requirements, such as enabling Hyper-V for Windows or installing dependencies on Linux.
If issues persist, consult Docker’s online documentation or community forums for solutions to specific error messages.
What is Docker Compose and do I need it?
Docker Compose is a tool used to define and run complex applications with multiple containers. While not necessary for installing Docker, it simplifies managing applications using a YAML file for configuration.
It’s incredibly useful when handling applications that require interlinked services running in separate containers.
How do I upgrade Docker to the latest version?
To upgrade Docker, download the latest version of Docker Desktop from the Docker website. On Linux, update the apt package index and follow the update process via your distribution’s package manager. For Windows and macOS, simply run the installer for the latest version over the existing installation.
Can Docker work with Kubernetes?
Absolutely, Docker and Kubernetes work together seamlessly. Docker containers run efficiently within Kubernetes clusters, which helps in automating deployment, scaling, and managing containerized applications.
Docker Desktop includes a Kubernetes option that can be enabled for local development and testing.
Do I need Docker Hub to run Docker?
While not strictly necessary, Docker Hub is useful for storing and retrieving Docker images. It’s a cloud-based registry where you can push images for others to use or pull images to run locally. Although not a prerequisite, it offers easy access to a vast collection of pre-built Docker images.
Conclusion
Understanding how to install Docker means opening doors to efficient software management across various operating systems. From initial setup on Windows, macOS, and Linux, the journey involves grasping fundamental command line actions and configurations. It’s not just about installing; it’s about enhancing your DevOps workflow and microservices architecture. By now, you should be equipped to handle Docker’s core functionalities, from dealing with Docker Compose for multi-container applications to troubleshooting common installation errors.
You’re not just downloading a tool; you’re adopting an advanced approach to application deployment and environment management. Whether integrating with Kubernetes or leveraging cloud platforms like AWS for container orchestration, you’ve taken a key step forward. It’s all about simplifying the complex and making technology work for you. Ready to explore beyond the basics, you’re well on your way to mastering containerization.
If you liked this article about how to install Docker, you should check out this article about Kubernetes vs Docker.
There are also similar articles discussing what is Docker hub, what is a Docker container, what is a Docker image, and what is Docker compose.
And let’s not forget about articles on where are Docker images stored, where are Docker volumes stored, how to use Docker, and how to start Docker daemon.
- Kotlin Regex: A Guide to Regular Expressions - April 22, 2025
- What Is the Kotlin Enum Class? Explained Clearly - April 22, 2025
- How To Work With Maps In Kotlin - April 21, 2025