Skip to main content

Docker

The official website: https://www.docker.com

Docker Hub: https://hub.docker.com

Installation

Unbuntu installation

See https://docs.docker.com/engine/install/ubuntu

If you're unable to connect to the official Docker download source, consider using the Tencent Cloud mirror as an alternative.

  1. Add the Docker source
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://mirrors.cloud.tencent.com/docker-ce/linux/ubuntu/ \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
  1. Install the Docker and tooling.
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
  1. Check whether Docker is running
systemctl status docker
  1. Check the Docker info
docker info

Windows installation

Enable CPU Virtualization

First, ensure your PC enable the CPU Virtualization in the BIOS.

Install Hyper-V

If you are using Windows 10/11 Home. You have to install the Hyper-V manaully.

Create a file, named "Hyper-V-Enable.bat", then run it as administrator.

warning

Running scripts as administrator from untrusted source would damage your computer.

We don't endorse this script.

Hyper-V-Enable.bat
Pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hyper-v.txt
for /f %%i in ('findstr /i . hyper-v.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hyper-v.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL

Then restart your PC.

Install Docker Desktop

Registry Mirrors

If you live in mainland China, you may face network issues about the connectivity to the official Docker registry.

You can configure the registry mirrors settings of Docker.

On Linux, run the code below to edit /etc/docker/daemon.json and copy paste the following content. Note: If you face permission issues, edit the file with sudo.

For example, Tencent cloud Docker registry mirror: https://mirror.ccs.tencentyun.com.

/etc/docker/daemon.json
{
"registry-mirrors": [
"https://mirror.ccs.tencentyun.com"
]
}

Then restart the Docker service.

sudo systemctl restart docker

Finally, check the mirrors settings are configured by the following comamnd.

sudo docker info

It should output Registry Mirrors block like this.

Insecure Registries:
127.0.0.0/8
Registry Mirrors:
https://docker-mirrors.example.com/
Live Restore Enabled: false