-
Notifications
You must be signed in to change notification settings - Fork 10
Setting up Docker
This is a quick guide on setting up Docker in your system. Navigate to the section that is relevant to your machine OS.
This section will guide you on how to set up Docker Desktop in a Windows machine.
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
-
Download
Docker Desktop Installer.exe
from here. -
Execute the installer by double-clicking it.
-
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.
-
You can now access Docker from your preferred terminal.
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
.
- 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
- Next, enable the
Virtual Machine Platform
feature by executing the following in PowerShell as Administrator:
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
-
Perform a restart on your machine for the updates to take place.
-
Download the Linux kernel update package from here.
-
Run the downloaded
.msi
file by double-clicking. You will most probably be prompted for elevated permissions. Please selectyes
to continue. -
Set WSL 2 as default version for your machine by running this in PowerShell:
wsl --set-default-version 2
- Launch the Microsoft Store and search for your preferred Linux distribution.
-
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".
-
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.
-
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.
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.
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)
- 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
- First, update
apt
package index and install packages that allow forapt
to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
- 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
- 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
- Again, update
apt
package index:
sudo apt-get update
- Install the latest version of Docker Engine and containerd:
sudo apt-get install docker-ce docker-ce-cli containerd.io
- 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
This section will guide you on how to set up Docker Desktop in a Mac machine.
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.
- Download the appropriate installer. For Mac with Intel chip, use this. For Mac with Apple chip, use this.
- Open the installer by double clicing on the downloaded
Docker.dmg
file. Next, drag the Docker icon to the Applications folder. - Next, execute
Docker.app
inApplications/
folder to start up Docker. - 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.