CentOS 7 安装Docker

CentOS 7 安装Docker

1.安装前提
目前,CentOS 仅发行版本中的内核支持 Docker。
Docker 运行在 CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上

2使用 yum 安装(CentOS 7下)
Docker 要求 CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。
通过 uname -r 命令查看你当前的内核版本

[root@cnetos7 local]# uname -r 
3.10.0-693.el7.x86_64

3.安装 Docker
Docker 软件包和依赖包已经包含在默认的 CentOS-Extras 软件源里,安装命令如下:

[root@cnetos7 local]# yum -y install docker

安装完成

Dependency Updated:
  libsemanage.x86_64 0:2.5-14.el7                            libsemanage-python.x86_64 0:2.5-14.el7           
  policycoreutils.x86_64 0:2.5-34.el7                        policycoreutils-python.x86_64 0:2.5-34.el7       
  python-dmidecode.x86_64 0:3.12.2-4.el7                     selinux-policy.noarch 0:3.13.1-268.el7_9.2       
  selinux-policy-targeted.noarch 0:3.13.1-268.el7_9.2        setools-libs.x86_64 0:3.3.8-4.el7                

Complete!

4.启动 Docker 后台服务

[root@cnetos7 local]# systemctl start docker.service
[root@cnetos7 local]# docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

测试运行 hello-world

[root@cnetos7 local]# docker run hello-world
Unable to find image 'hello-world:latest' locally
Trying to pull repository docker.io/library/hello-world ... 
latest: Pulling from docker.io/library/hello-world
0e03bdcc26d7: Pull complete 
Digest: sha256:31b9c7d48790f0d8c50ab433d9c3b7e17666d6993084c002c2ff1ca09b96391d
Status: Downloaded newer image for docker.io/hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xiongyingli

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值