Setting up Docker
In today’s development environment, containerization has become an essential practice for developers and IT professionals. Docker, one of the leading containerization platforms, allows us to automate the deployment of applications inside lightweight, portable, and self-sufficient containers. This technology not only simplifies the process of managing application dependencies and packages but also ensures that your application works cross-platform.
In this tutorial, we will guide you through the step-by-step process of setting up Docker on your system. Whether you are a new developer looking to learn about Docker or a seasoned one, this tutorial will guide you through the setup process for the following operating systems:
- Mac
- Windows
- Linux
Docker setup for Mac
To set up Docker in MacOS, open the official Docker website to download the Docker desktop. Once the download is completed, install it on your Mac system.
👁 Images showing the download links
Once the installation is done, run the Docker desktop and open your terminal. In the terminal run the command docker –version to see the current version of Docker. Run docker run hello-world to confirm containers are working.
Docker setup for Windows
In Windows, the procedure for setting up Docker is the following:
- You will have to make sure Windows features required to run Docker are enabled. To turn these on search
Turn Windows features on or offand open it. - Once it is open, select the options called
Hyper-VandWindows Subsystem for Linux
👁 Image showing which window feature to select
👁 Image showing which window feature to select
Press OK to restart your system.
Once this is done, download the Docker desktop from Docker website and install it.
After installation, if your PC doesn’t have
WSLenabled, you will get an error message like this:
To fix the problem, you must copy the given command in the error message and paste it inside
PowerShell. Make sure to runPowerShellas administrator. Once you run the command, your system will restart.With this, the installation of Docker is done. To confirm it is working run the following two commands:
👁 Images showing the docker listing in CMD
👁 Images showing "Hello Docker!" confirmation.
Docker setup for Linux
When it comes to Linux, you must be careful as Docker only supports Ubuntu, Debian, Red Hat Enterprise Linux (RHEL), and Fedora. You can follow the steps below to setup Docker on Linux:
Checking the KVM Virtualization Support
- To load the module, run:
modprobe kvmCopy to clipboardCopy to clipboard
- Depending on your CPU, the next command will differ:
modprobe kvm_intel # Intel processorsmodprobe kvm_amd # AMD processorsCopy to clipboardCopy to clipboard
- To check if the KVM module is working, run the Command:
lsmod | grep kvmCopy to clipboardCopy to clipboard
The following steps require you to set up KVM device user permissions:
- You will have to check the ownership of
/dev/kvmand to do that, run:
ls -al /dev/kvmCopy to clipboardCopy to clipboard
- The next step requires you to add your user name,
$USER, to the kvm group:
sudo usermod -aG kvm $USERCopy to clipboardCopy to clipboard
You are done with checking the KVM. Now we will move to setting up the Docker Desktop.
Setting up the Docker Desktop in Linux
- First, you need to update your package database. To do that, run:
sudo apt get-updateCopy to clipboardCopy to clipboard
- Install the Docker engine like so:
sudo apt install docker.ioCopy to clipboardCopy to clipboard
- Once the above installation is done, you need to enable the docker services. To do that, run the following commands:
sudo systemctl enable dockerCopy to clipboardCopy to clipboard
To confirm that the docker services are running, run the command:
sudo systemctl statusCopy to clipboardCopy to clipboard
Note: If the services are not running, run the command:
sudo systemctl start dockerCopy to clipboardCopy to clipboard
- Finally, to check if Docker is running, run a Docker container like so:
sudo docker run hello-worldCopy to clipboardCopy to clipboard
- You should get a response like this:
- Get hands-on with Docker! Explore containers, Dockerfiles, workflows, and use cases while learning resource management for consistent, scalable deployment.
- Beginner Friendly.1 hour1 hour
Conclusion
Congratulations! In this article, we’ve walked through setting up a Docker container for Mac, Windows, and Linux—the first step towards mastering Docker. With Docker, you’re now equipped to create consistent and isolated environments for your applications, making development, testing, and deployment more efficient and reliable.
To learn more about computer science concepts, check out these articles on Codecademy.
'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'
Meet the full teamRelated articles
- Article
What is Docker?
Introduction to Docker - Article
What is a Docker Container - A Complete Guide
Learn what Docker files, images, and containers are and how to create them. - Article
Docker Compose Tutorial
Learn how to set up and manage multi-container Docker applications using Docker Compose, including configuring services, environment variables, and more.
Learn more on Codecademy
- Get hands-on with Docker! Explore containers, Dockerfiles, workflows, and use cases while learning resource management for consistent, scalable deployment.
- Beginner Friendly.1 hour1 hour
