CodeGym /Courses /Docker SELF /Installing Docker

Installing Docker

Docker SELF
Level 9 , Lesson 3
Available

4.1 Installing Docker on Windows 10

System Requirements

Before installing Docker on Windows, make sure your computer meets the following requirements:

  1. Operating System: Windows 10 64-bit (Pro, Enterprise, or Education, Build 15063 or later).
  2. Hyper-V enabled.

Enabling Hyper-V

Hyper-V is a virtualization technology from Microsoft, which is required for Docker to work on Windows. To enable Hyper-V:

  1. Open the "Control Panel" and go to the "Programs" section.
  2. Click "Turn Windows features on or off."
  3. Check the box next to "Hyper-V" and click "OK."
  4. Restart your computer for the changes to take effect.

Installing WSL

Open PowerShell as an administrator and run the command: wsl --install. This will install WSL 2.

If something goes wrong, a detailed guide is available at this link

If virtualization still doesn't work, most likely, it needs to be enabled in the BIOS. This often happens on AMD platforms. In such a case, if you, for example, have an MSI setup, you need to do the following:

  • Enter the BIOS
  • Overclocking settings > OC Explore Mode enable Expert
  • CPU Features > Enable SVM Mode

If your BIOS looks different... Well, that's normal. In that case, make a Google search for something like enable virtualization in bios asus.

Downloading and Installing Docker Desktop

  1. Go to the official Docker website and download the Docker Desktop installer for Windows.
  2. Run the downloaded installer.
  3. Follow the installation wizard instructions, accepting the license agreement and choosing the necessary options.
  4. After installation is complete, run Docker Desktop.

Setting Up Docker Desktop

When starting Docker Desktop for the first time:

  1. You will be prompted to accept the license agreement. Accept it.
  2. Docker Desktop will automatically configure and start the Docker server.
  3. A Docker icon will appear in the system tray, indicating Docker has started successfully.

Verifying Installation

To verify Docker is installed successfully:

  1. Open the Command Prompt (CMD) or PowerShell.
  2. Enter the command docker --version and make sure the Docker version is displayed correctly.

4.2 Installing Docker on Windows 11

System Requirements

Before installing Docker on a PC with Windows 11, make sure your computer meets the following requirements:

  • Operating System: Windows 11 64-bit.
  • Hyper-V and WSL 2 (Windows Subsystem for Linux 2) enabled.

Enabling Hyper-V and WSL 2

Hyper-V and WSL 2 are Microsoft's virtualization technologies required for Docker to work on Windows 11. To enable Hyper-V and WSL 2:

  1. Open the "Start" menu and type "Control Panel," then select it.
  2. Go to the "Programs" section.
  3. Click "Turn Windows features on or off."
  4. Check the boxes next to "Hyper-V," "Virtual Machine Platform," and "Windows Subsystem for Linux."
  5. Click "OK" and restart your computer to apply the changes.

Downloading and Installing Docker Desktop

  1. Go to the official Docker website and download the Docker Desktop installer for Windows.
  2. Run the downloaded installer.
  3. Follow the installation wizard instructions, accepting the license agreement and selecting the necessary options.
  4. Once the installation is complete, launch Docker Desktop.

Setting Up Docker Desktop

During the first launch of Docker Desktop:

  1. Open the Command Prompt (CMD) or PowerShell.
  2. Enter the command docker --version and make sure the Docker version is displayed correctly.

4.3 Installing Docker on Windows 7

Unfortunately, Docker Desktop is not officially supported on Windows 7. However, you can still use Docker on Windows 7 by using a virtual machine. Below is the guide on how to install Docker on Windows 7 using VirtualBox and Docker Toolbox.

System Requirements

Before installing Docker on Windows 7, make sure your computer meets the following requirements:

  • Operating System: Windows 7 64-bit.
  • Processor: Support for virtualization (VT-x for Intel or AMD-V for AMD).
  • Enabled virtualization feature in BIOS.

Installing VirtualBox and Docker Toolbox

  1. Download VirtualBox:
    • Go to the official VirtualBox website and download the installer for Windows.
    • Run the installer and follow the installation wizard instructions.
  2. Download Docker Toolbox:
    • Go to the Docker Toolbox download page on GitHub and download the latest version of Docker Toolbox for Windows.
    • Run the downloaded Docker Toolbox installer.
    • Follow the installation wizard instructions, accept the license agreement, and select the necessary options.

Setting Up Docker Toolbox

After installing Docker Toolbox, follow these steps to configure it:

  1. Launch Docker Quickstart Terminal:
    • Open Docker Quickstart Terminal (the icon should appear on your desktop after installation).
    • Docker Quickstart Terminal will automatically set up the Docker virtual machine using VirtualBox and start the Docker server.
    • Wait until the message confirming Docker has started successfully appears.
  2. Verify the Installation:
    • After starting Docker Quickstart Terminal, enter the command docker --version in the terminal.
    • Make sure the Docker version is displayed correctly.

Notes

  • Docker Toolbox includes Docker Engine, Docker Machine, and Docker Compose.
  • Docker Quickstart Terminal launches the virtual machine with minimal required settings. You can configure the virtual machine through VirtualBox to improve performance and adjust other parameters.

4.4 Installing Docker on macOS

System Requirements

Before installing Docker on macOS, make sure your computer meets the following requirements:

  • Operating System: macOS 10.13 or higher.
  • Processor with 64-bit support.

Downloading and Installing Docker Desktop

  1. Go to the official Docker website and download the Docker Desktop installer for macOS.
  2. Open the downloaded .dmg file.
  3. Drag and drop Docker.app into the "Applications" folder.

Starting Docker Desktop

For the first launch of Docker Desktop:

  1. Open Docker.app from the "Applications" folder.
  2. You might need to enter the administrator password to complete the installation.
  3. Docker Desktop will automatically configure and start the Docker server.
  4. The Docker icon will appear in the menu bar, indicating that Docker has successfully started.

Configuring Docker Desktop

Upon the first launch, Docker Desktop will configure the system for optimal work with Docker containers. Docker Desktop integrates with system settings and provides a user-friendly interface for managing Docker.

Verifying Installation

To verify that Docker is installed successfully:

  1. Open the terminal.
  2. Enter the command docker --version and make sure the Docker version is displayed correctly.

4.5 Installing Docker on Linux (Ubuntu)

System Requirements

Before installing Docker on Ubuntu, make sure your computer meets the following requirements:

  • Operating System: Ubuntu 18.04 or higher.
  • 64-bit version.

Detailed guide on the official site

Updating Packages

First, you need to update your package list:

Terminal

sudo apt-get update
       

Installing Required Packages

Next, install the required packages to add the Docker repository:

Terminal

sudo apt-get install \
   ca-certificates \
   curl \
   gnupg \
   lsb-release

Adding Docker Official GPG Key

Download and add the Docker’s official GPG key:

Terminal

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o 
/usr/share/keyrings/docker-archive-keyring.gpg 

Adding Docker Repository

Add the official Docker repository to your system:

Terminal

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 

Installing Docker Engine

You can now install the Docker Engine:

Terminal

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io

Starting Docker

Start Docker and make sure it’s set to start automatically upon system boot:

Terminal

sudo systemctl start docker
sudo systemctl enable docker

Verifying Installation

To verify that Docker was installed successfully:

Terminal

sudo usermod -aG docker $USER 
sudo chmod 666 /var/run/docker.sock
sudo docker --version

Make sure the Docker version is displayed correctly.

3
Task
Docker SELF, level 9, lesson 3
Locked
Preparing to Install Docker on Windows 11
Preparing to Install Docker on Windows 11
3
Task
Docker SELF, level 9, lesson 3
Locked
Preparing to Install Docker on Windows 10
Preparing to Install Docker on Windows 10
3
Task
Docker SELF, level 9, lesson 3
Locked
Installing Docker on macOS
Installing Docker on macOS
3
Task
Docker SELF, level 9, lesson 3
Locked
Installing Docker on Ubuntu
Installing Docker on Ubuntu
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION