1、系统要求

Docker CE 支持 64 位版本 CentOS 7,并且要求内核版本不低于 3.10。 CentOS 7
满足最低内核的要求,但由于内核版本比较低,部分功能(如 overlay2 存储层
驱动)无法使用,并且部分功能可能不太稳定。

2、配置阿里云Docker Yum源

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3、卸载旧版本

sudo yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine

4、使用脚本自动安装Docker

curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh --mirror Aliyun

5、启动 Docker CE

sudo systemctl enable docker
sudo systemctl start docker

6、建立 docker 用户组

默认情况下, docker 命令会使用 Unix socket 与 Docker 引擎通讯。而只有root 用户和 docker 组的用户才可以访问 Docker 引擎的 Unix socket。出于安全考虑,一般 Linux 系统上不会直接使用 root 用户。因此,更好地做法是将需要使用 docker 的用户加入 docker 用户组。
建立 docker 组:

sudo groupadd docker

将当前用户加入 docker 组:

sudo usermod -aG docker $USER

退出当前终端并重新登录,进行如下测试。

测试 Docker 是否安装正确

docker run hello-world

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
d1725b59e92d: Pull complete
Digest: sha256:0add3ace90ecb4adbf7777e9aacf18357296e799f81cabc9f
de470971e499788
Status: Downloaded newer image for 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:
. The Docker client contacted the Docker daemon.
. The Docker daemon pulled the "hello-world" image from the Do
cker Hub.
(amd64)
. The Docker daemon created a new container from that image wh
ich runs the
executable that produces the output you are currently readin
g.
. 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/

若能正常输出以上信息,则说明安装成功。

最新文章

  1. expect用法
  2. 基础算法之快速排序Quick Sort
  3. Python导入模块出现“no module named **”可能是这样的原因
  4. iOS APNS配置(转)
  5. [翻译]:SQL死锁-锁的类型
  6. leetcode_438_Find All Anagrams in a String_哈希表_java实现
  7. c中static作用
  8. Codevs 1009 产生数
  9. android使用广播退出应用程序
  10. BeyondCompare常用功能图解
  11. Linux内核的同步机制---自旋锁
  12. .net SoapHeader验证
  13. 分布式文件系统:HDFS
  14. 分析Array.apply(null, { length: 5 })
  15. SDRAM操作说明
  16. Java数据结构简述
  17. Confluence 6 手动备份站点
  18. Codeforces 725E Too Much Money (看题解)
  19. Peer Programming Project: 4 Elevators Scheduler 附加题 157 165
  20. 20135337——实践一:Linux基础配置

热门文章

  1. Spring 源码学习(4) —— 动态AOP使用示例
  2. 「LibreOJ β Round #4」游戏
  3. 【转】 虚拟机Linux不能上网简单有效的解决办法(NAT模式下)
  4. 解决 sun.security.validator.ValidatorException: PKIX path building failed
  5. Java 9 中的 9 个新特性
  6. NYOJ 136 等式 (哈希)
  7. python初步学习-异常
  8. 黑色的cms商城网站后台管理模板——后台
  9. Sqlmap与burpsuite动态更新某些参数
  10. git@oschina.net源代码管理使用日记【转】