Docker--安装

一键安装

wget -O /etc/yum.repos.d/docker-ce.repo https://download.docker.com/linux/centos/docker-ce.repo && yum install -y docker-ce && systemctl enable docker.service && service docker start

安装

Install using the repository
  • SET UP THE REPOSITORY
    Before you install Docker CE for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

    1. Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data and lvm2 are required by the devicemapper storage driver.

      sudo yum install -y yum-utils device-mapper-persistent-data lvm2

    2. Use the following command to set up the stable repository. You always need the stable repository, even if you want to install builds from the edge or testing repositories as well.

      sudo yum-config-manager \
      –add-repo \
      https://download.docker.com/linux/centos/docker-ce.repo

  • INSTALL DOCKER CE

    1. Update the yum package index.

      $ sudo yum makecache fast

    2. Install the latest version of Docker CE, or go to the next step to install a specific version.

      $ sudo yum install docker-ce
      检索密钥:
      060A 61C5 1B55 8A7F 742B 77AA C52F EB6B 621E 9F35

    3. Install a specific version on production systems

      $ sudo yum list docker-ce.x86_64 –showduplicates | sort -r
      sudo yum install docker-ce-< VERSION >

  • Start and Verify

    $ sudo systemctl start docker
    sudo docker run hello-world

阿里云镜像

前往https://cr.console.aliyun.com注册

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-‘EOF’
{
“registry-mirrors”: [“https://xxxxxxx.mirror.aliyuncs.com“]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

卸载

yum remove -y docker-ce
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值