Open dushaoshuai opened 9 months ago
# Add tsinghua Docker CE 源 GPG key: sudo apt-get update sudo apt-get install ca-certificates curl gnupg sudo install -m 0755 -d /etc/apt/keyrings curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg sudo chmod a+r /etc/apt/keyrings/docker.gpg # Add the repository to Apt sources: echo \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://mirrors.tuna.tsinghua.edu.cn/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
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo docker run hello-world
To create the docker group and add your user:
$ sudo groupadd docker
$ sudo usermod -aG docker $USER
$ newgrp docker
$ docker run hello-world
现在国内的镜像源都不好使了,我目前是用 clash-verge-rev 的 tun 模式来解决。
/etc/docker/daemon.json:
/etc/docker/daemon.json
{ "registry-mirrors": [ "https://reg-mirror.qiniu.com", "https://ceok5l2c.mirror.aliyuncs.com", "https://registry.docker-cn.com", "https://hub-mirror.c.163.com/" ] }
(不知道为什么,添加上 https://registry.aliyuncs.com/google_containers/ 会导致 docker 启动/重启失败,有待探究)(因为这是 k8s.gcr.io 的镜像源,不是 Docker Hub 镜像源,😂)
https://registry.aliyuncs.com/google_containers/
k8s.gcr.io
reload Docker for the change to take effect:
sudo systemctl restart docker.service
上面已经安装了 docker-compose-plugin。
docker-compose-plugin
# Verify that Docker Compose is installed correctly by checking the version. $ docker compose version Docker Compose version v2.24.7
Install using the apt repository
Set up Docker's apt repository.
Install the Docker packages.
Verify that the Docker Engine installation is successful by running the hello-world image.
Manage Docker as a non-root user
To create the docker group and add your user:
Create the docker group.
Add your user to the docker group.
Activate the changes to groups.
Verify that you can run docker commands without sudo.
使用国内 Docker Hub 镜像源
现在国内的镜像源都不好使了,我目前是用 clash-verge-rev 的 tun 模式来解决。
/etc/docker/daemon.json
:(不知道为什么,添加上
https://registry.aliyuncs.com/google_containers/
会导致 docker 启动/重启失败,有待探究)(因为这是k8s.gcr.io
的镜像源,不是 Docker Hub 镜像源,😂)reload Docker for the change to take effect:
Install Docker Compose
上面已经安装了
docker-compose-plugin
。参见