Docker安装教程

23

安装方法

官方教程

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg -y
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://download.docker.com/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

通过Aliyun镜像安装

curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/aliyun-docker.gpg
​
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/aliyun-docker.gpg] https://mirrors.aliyun.com/docker-ce/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
​
# 验证
sudo docker info

通过腾讯云镜像安装

curl -fsSL https://mirrors.tencent.com/docker-ce/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/tencent-docker.gpg
​
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/tencent-docker.gpg] https://mirrors.tencent.com/docker-ce/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
​
# 验证
sudo docker info

配置http私有仓库

sudo vim /etc/docker/daemon.json

# 添加以下内 容
{
  "insecure-registries": [
    "192.168.2.210:5000"
  ]
}

配置docker镜像仓库

中科大镜像源:https://docker.mirrors.ustc.edu.cn

腾讯云内网镜像源:https://mirror.ccs.tencentyun.com

# 不存在则创建
$ sudo vi /etc/docker/daemon.json

{
 "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}

其他

k8s安装教程(ubuntu22.04): https://cloud.tencent.com/developer/article/2057996

# 授权docker权限给woolsen用户
sudo usermod -aG docker woolsen
 
# 运行kuboard
sudo docker run -d \  
    --restart=unless-stopped \  
    --name=kuboard \  
    -p 8008:80/tcp \  
    -p 10081:10081/tcp \  
    -e KUBOARD_ENDPOINT="http://192.168.2.210:80" \  
    -e KUBOARD_AGENT_SERVER_TCP_PORT="10081" \  
    -v /root/kuboard-data:/data \  
    eipwork/kuboard:v3