ubuntu安装docker

ubuntn安装docker

  1. 卸载旧版本
sudo apt-get remove docker docker-engine docker.io containerd runc
  1. 获取软件最新源
sudo apt-get update
  1. 安装apt依赖包
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common
  1. 安装gpg证书
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -
  1. 验证
sudo apt-key fingerprint 0EBFCD88
  1. 设置稳定版仓库
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"
  1. 更新apt包索引
sudo apt-get update
  1. 安装最新版docker
sudo apt-get install docker-ce docker-ce-cli containerd.io
  1. 查看docker版本
docker --version 
  1. 更换获取源
    新建文件 /etc/docker/deamon.json
    文件添加以下内容
{
 "registry-mirrors" : [
    "https://registry.docker-cn.com",
    "http://hub-mirror.c.163.com",
    "https://docker.mirrors.ustc.edu.cn/",
    "https://yxzrazem.mirror.aliyuncs.com",
    "https://docker.kubesre.xyz",
    "https://dc.j8.work",
    "https://docker.registry.cyou",
    "https://docker.hlyun.org",
    "https://docker.chenby.cn",
    "https://docker.jsdelivr.fyi",
    "https://docker-mirrors.mjjman.com",
    "https://docker.kubesre.xyz",
    "https://huecker.io",
    "https://dockerhub.timeweb.cloud",
    "https://docker.registry.cyou",
    "https://docker-cf.registry.cyou",
    "https://dockercf.jsdelivr.fyi",
    "https://dockertest.jsdelivr.fyi"
 ]
}
  1. 重启docker
sudo systemctl daemon-reload
sudo systemctl restart docker
  1. 拉取并运行hello-word
sudo docker run hello-world
  1. 查看docker镜像列表
sudo docker images
  1. 启动docker
systemctl start docker
  1. 停止docker
 systemctl stop docker
  1. 重启docker
systemctl restart docker
  1. 设置docker开机启动
sudo systemctl enable docker

docker安装nginx

sudo docker search nginx
sudo docker pull nginx
sudo docker images
sudo docker run -d --name nginx01 -p 3344:80 nginx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值