ubuntu18.04安装docker

1.更新镜像源并安装依赖

apt update && apt upgrade  -y
apt -y install ipvsadm ipset apt-transport-https 
apt -y install ca-certificates curl software-properties-common apt-transport-https

2.安装docker

#step 1: 安装GPG证书
curl -fsSL http://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
# Step 2: 写入软件源信息
add-apt-repository "deb [arch=amd64] http://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
# Step 3: 更新并安装 Docker-CE
apt-get -y update
# Step 3: 查看存在的版本信息
apt-cache madison docker-ce
apt-get install docker-ce=<VERSION_STRING> 

3.配置docker
(1). mkdir /etc/systemd/system/docker.service.d
vim /etc/systemd/system/docker.service.d/private-registry.conf

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --insecure-registry IP:port

–insecure-registry 指私有的docker 仓库的地址
(2). 配置 docker 加速器
vim /etc/docker/daemon.json

{
    "log-driver": "json-file",
    "exec-opts": ["native.cgroupdriver=cgroupfs"],
    "log-opts": {
    "max-size": "100m",
    "max-file": "3"
    },
    "live-restore": true,
    "max-concurrent-downloads": 10,
    "max-concurrent-uploads": 10,
    "registry-mirrors": ["https://hccwwfjl.mirror.aliyuncs.com"],
    "storage-driver": "overlay2",
    "storage-opts": [
    "overlay2.override_kernel_check=true"
    ]
}

(3). 配置docker 代理
vim /etc/systemd/system/docker.service.d/http-proxy.conf

[Service]
Environment="HTTP_PROXY=http:/" "HTTPS_PROXY=http:/"

(4). 加载配置信息并重启docker

systemctl daemon-reload
systemctl  restart docker

(5). 查看docker 基本信息

docker info
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值