(1)centos7安装 Docker

1、安装lsb_release:
[root@VM_0_8_centos ~]#yum install -y redhat-lsb
2、查看版本:
[root@VM_0_8_centos ~]# lsb_release -a

LSB Version:	:core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID:	CentOS
Description:	CentOS Linux release 7.5.1804 (Core) 
Release:	7.5.1804
Codename:	Core
3、修改主机名(可选):
[root@centos7 ~]$ hostnamectl set-hostname centos77.magedu.com             # 使用这个命令会立即生效且重启也生效
[root@centos7 ~]$ hostname                                                 # 查看下
centos77.magedu.com
[root@centos7 ~]$ vim /etc/hosts                                           # 编辑下hosts文件, 给127.0.0.1添加hostname
[root@centos7 ~]$ cat /etc/hosts                                           # 检查
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4 centos77.magedu.com
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

4、查看内核版本:
[root@VM_0_8_centos ~]# uname -a
Linux starseaing9228 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
5、安装一些必要的系统工具:

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

6、添加软件源信息:

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

7、更新 yum 缓存:

yum makecache fast

8、安装 Docker-ce:

yum -y install docker-ce

9、启动 Docker 后台服务:

systemctl start docker

10、测试运行 hello-world:

[root@runoob ~]# docker run hello-world

配置镜像加速器。修改镜像源地址:

新版的 Docker 推荐使用 json 配置文件的方式,默认为 /etc/docker/daemon.json,非默认路径需要修改 dockerd 的 –config-file、

针对Docker客户端版本大于 1.10.0 的用户
您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器,重启docker生效

daemon.json内容如下:

{
"registry-mirrors": [
"https://uz3ztep2.mirror.aliyuncs.com",
"http://hub-mirror.c.163.com",
"https://registry.docker-cn.com",
"https://docker.mirrors.ustc.edu.cn"
]
}
[root@starseaing9228 ~]# vi /etc/docker/daemon.json 
[root@starseaing9228 ~]# 
[root@starseaing9228 ~]# systemctl daemon-reload
[root@starseaing9228 ~]# systemctl restart docker
查看docker的状态

[root@starseaing9228 ~]# docker stats -a

CONTAINER ID        NAME                  CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
62da11435b1e        determined_rosalind   0.24%               64.75MiB / 1.796GiB   3.52%               402kB / 1.18MB      190MB / 2.02GB      30
6dbc2c38e2b7        elasticsearch245      0.29%               216.2MiB / 1.796GiB   11.76%              248kB / 180kB       87.5MB / 115kB      33
6caa3735ebe9        tomcat8.5-1           0.00%               0B / 0B               0.00%               0B / 0B             0B / 0B             0
5ac6c3a867c5        tomcat8.5             0.16%               81.47MiB / 1.796GiB   4.43%               866kB / 9.32MB      64.2MB / 0B         41
36c648227400        redis1                0.14%               7.867MiB / 1.796GiB   0.43%               3.35MB / 3.35MB     8.46MB / 32.8kB     4
5ef98c357973        mysql57               0.05%               218.3MiB / 1.796GiB   11.87%              4.75MB / 5.19MB     133MB / 36.5MB      37
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值