Ubuntu 在线 安装 Docker

Ubuntu 在线 安装 Docker

bash 复制代码
sudo apt-get update
sudo apt-get install ca-certificates curl gnupg lsb-release
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) 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-compose-plugin

开启国内镜像加速

修改 /etc/docker/daemon.json 文件(若无自己创建),修改为如下形式

json 复制代码
{
  "registry-mirrors": [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn"
  ]
}
bash 复制代码
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo docker info

开启docker 远程访问API

bash 复制代码
sudo vim /lib/systemd/system/docker.service
# 找到ExecStart
将 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H 
# 修改为
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock
# 保存退出。
bash 复制代码
sudo systemctl daemon-reload
sudo systemctl restart docker
bash 复制代码
curl http://ip:2375/version
相关推荐
吃饱了得干活11 小时前
Spring Cloud Gateway 微服务网关:路由、断言、过滤器
java·spring cloud
Warson_L11 小时前
Python `Annotated` 与 LangGraph Reducer 学习笔记
python
韩师傅11 小时前
海天线算法的前世今生
python·计算机视觉
大大大大晴天11 小时前
Hudi Metadata Table 与 Hive Sync (HMS)怎么选?
大数据
韩师傅11 小时前
当你的甲方设备过烂,要如何快速出效果?
python·计算机视觉
Warson_L11 小时前
LangGraph的MessageState and HumanMessage
python
韩师傅12 小时前
当你的甲方吐槽天空不够蓝,你应该如何应对
python·计算机视觉
lwx5728012 小时前
探秘InnoDB:搞懂它的内存、线程、磁盘与日志刷盘策略
java·后端
Warson_L12 小时前
python的类&继承
python
Warson_L13 小时前
类型标注/type annotation
python