Skip to content

Setting up Docker

KY Lee ( Ken ) edited this page Aug 6, 2021 · 1 revision

This is a quick guide on setting up Docker in your system. Navigate to the section that is relevant to your machine OS.

Contents

Setting Up Docker for Windows

This section will guide you on how to set up Docker Desktop in a Windows machine.

System Requirements

The machine must meet the following minimum requirements:

  • Configured WSL 2 backend, refer to here on configuration guides
  • Windows 10 64-bit: Home, Pro, Enterprise, or Education, version 1903 (Build 18362 or higher).
  • Enabled the WSL 2 feature on Windows. For detailed instructions, refer to the Microsoft documentation.
  • Installed Linux kernel update package

Steps

  1. Download Docker Desktop Installer.exe from here.

  2. Execute the installer by double-clicking it.

  3. Docker will start automatically once the installation completes. You will see a new whale notification icon in the notification area (usually in the bottom right corner) which indicates that Docker is running.

  4. You can now access Docker from your preferred terminal.

WSL 2 Requirements

Windows Subsystem for Linux 2 (WSL 2) is an effort by Microsoft to ...run a GNU/Linux environment -- including most command-line tools, utilities, and applications -- directly on Windows, unmodified, without the overhead of a traditional virtual machine or dualboot setup.

Quoting Microsoft, WSL 2 has:

  • increase file system performance,
  • support full system call compatibility.

The following hardware prerequisites are required to configure WSL 2 on Windows 10:

  • For x64 systems: Version 1903 or higher, with Build 18362 or higher.
  • For ARM64 systems: Version 2004 or higher, with Build 19041 or higher.

NOTE: You can check your version and build number by entering Windows logo key + R. In the popped up Run interface, input winver and select OK.

Steps to Install and Configure WSL 2

  1. First, enable WSL feature. To do this, open PowerShell as Administrator and run the following:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
  1. Next, enable the Virtual Machine Platform feature by executing the following in PowerShell as Administrator:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
  1. Perform a restart on your machine for the updates to take place.

  2. Download the Linux kernel update package from here.

  3. Run the downloaded .msi file by double-clicking. You will most probably be prompted for elevated permissions. Please select yes to continue.

  4. Set WSL 2 as default version for your machine by running this in PowerShell:

wsl --set-default-version 2
  1. Launch the Microsoft Store and search for your preferred Linux distribution.

image

  1. Click on it to go to the specific distribution's page (for example, Ubuntu 20.04 LTS page is hosted at https://www.microsoft.com/store/apps/9n6svws3rx71), and click "Get".

  2. Wait for the installation to complete and launch the newly installed distribution. First time launching will take slightly longer (about few minutes). Subsequent launches should take less than a second.

  3. Create a user account and password for the newly installed Linux distribution as prompted by the terminal.

By now, you should have successfully set up a Linux distribution that is integrated with Windows OS in your machine.

Setting Up Docker for Linux

This section will guide you on how to set up Docker Engine in a Linux machine by setting up a repository. Specifically, the Linux distribution demonstrated here is Ubuntu.

System Requirements

A 64-bit version of one of these Ubuntu versions is required:

  • Ubuntu Hirsute 21.04
  • Ubuntu Groovy 20.10
  • Ubuntu Focal 20.04 (LTS)
  • Ubuntu Bionic 18.04 (LTS)
  • Ubuntu Xenial 16.04 (LTS)

Steps

  1. You might have previously installed older versions of Docker. If yes, we should first uninstall them by:
sudo apt-get remove docker docker-engine docker.io containerd runc
  1. First, update apt package index and install packages that allow for apt to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg \
    lsb-release
  1. Next, add Docker's GPG key:
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
  1. Set up the stable repository (x86_64/amd64):
echo \
  "deb [arch=amd64 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
  1. Again, update apt package index:
sudo apt-get update
  1. Install the latest version of Docker Engine and containerd:
sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. You can verify that Docker Engine is installed properly by running the hello-world image, which comes together during installation:
sudo docker run hello-world

Setting Up Docker for Mac

This section will guide you on how to set up Docker Desktop in a Mac machine.

System Requirements

Requirements for Intel chip:

  • macOS must be version 10.14 or newer. That is, Mojave, Catalina, or Big Sur.
  • At least 4 GB of RAM.
  • VirtualBox prior to version 4.3.30 must not be installed as it is not compatible with Docker Desktop.

Requirements for Apple silicon:

  • Rosetta 2 must be installed as some binaries are still Darwin/AMD64.

Steps

  1. Download the appropriate installer. For Mac with Intel chip, use this. For Mac with Apple chip, use this.
  2. Open the installer by double clicing on the downloaded Docker.dmg file. Next, drag the Docker icon to the Applications folder.
  3. Next, execute Docker.app in Applications/ folder to start up Docker.
  4. Docker Desktop should be up and running by now, which also allows it to be accessed through terminals. You can verify this by spotting the Docker menu in the status bar.

image

References