说明:
本文介绍如何在CentOS7的系统上安装部署Docker环境,本文参考Docker官方文档如下链接:
https://docs.docker.com/engine/installation/centos/
CentOS7的系统上安装部署Docker环境
1 CentOS7安装(略)
2 升级系统
yum update
升级完成后需要重启下系统。
3 添加docker yum源
执行如下命令:
cat >/etc/yum.repos.d/docker.repo name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7 enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF
4 安装Docker软件包
yum install docker-engine
5 启动Docker服务
service docker start
6 测试运行下hello-world镜像
docker run hello-world
7 查看docker信息
使用docker info 命令可以参考系统、Docker的详细信息:
docker info Containers: 3 Images: 2 Server Version: 1.9.0 Storage Driver: devicemapper Pool Name: docker-253:0-202597120-pool Pool Blocksize: 65.54 kB Base Device Size: 107.4 GB Backing Filesystem: xfs Data file: /dev/loop2 Metadata file: /dev/loop3 Data Space Used: 1.824 GB Data Space Total: 107.4 GB Data Space Available: 47.87 GB Metadata Space Used: 1.655 MB Metadata Space Total: 2.147 GB Metadata Space Available: 2.146 GB Udev Sync Supported: true Deferred Removal Enabled: false Deferred Deletion Enabled: false Deferred Deleted Device Count: 0 Data loop file: /var/lib/docker/devicemapper/devicemapper/data Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata Library Version: 1.02.93-RHEL7 (2015-01-28) Execution Driver: native-0.2 Logging Driver: json-file Kernel Version: 3.10.0-229.20.1.el7.x86_64 Operating System: CentOS Linux 7 (Core) CPUs: 24 Total Memory: 11.57 GiB Name: localhost.localdomain ID: VIAJ:MW46:FVFJ:QN7G:XI66:OUBO:M65B:KAUE:BIPC:LL5D:HBCL:762N
8 创建docker用户组,并将用户放到docker组内部
建议使用非root用户运行docker,因为root用户运行docker镜像非常不安全。
创建test1用户,并将用户加入到docker用户组:
[[email protected]~]# useradd test1
[[email protected]~]# usermod -aG docker test1
切到test1用户,运行docker镜像:
[[email protected]~]# su test1
[[email protected]]$
[[email protected]]$ docker run hello-world
9 设置dock服务开机启动
chkconfig docker on
10 卸载Docker
yum list installed | grep docker
yum -y remove docker-engine.x86_64
rm -rf /var/lib/docker
然后删除相关用户。
补充说明:
关于Docker的网络
和kvm类似,看起来也是使用网桥的方式:
[[email protected] ~]# ifconfig docker0: flags=4163 mtu 1500 inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0 inet6 fe80::42:84ff:fe7f:4510 prefixlen 64 scopeid 0x20 ether 02:42:84:7f:45:10 txqueuelen 0 (Ethernet) RX packets 12 bytes 840 (840.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 3 bytes 258 (258.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 0 (Local Loopback) RX packets 20530318 bytes 1812359321 (1.6 GiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 20530318 bytes 1812359321 (1.6 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 veth9422d62: flags=4163 mtu 1500 inet6 fe80::6c36:d0ff:fef5:3996 prefixlen 64 scopeid 0x20 ether 6e:36:d0:f5:39:96 txqueuelen 0 (Ethernet) RX packets 8 bytes 648 (648.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 10 bytes 828 (828.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [[email protected] ~]# brctl show bridge name bridge id STP enabled interfaces docker0 8000.0242847f4510 no veth9422d62 [[email protected] ~]#
感谢阅读,希望能帮助到大家,谢谢对本站的支持!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- 雨林唱片《赏》新曲+精选集SACD版[ISO][2.3G]
- 罗大佑与OK男女合唱团.1995-再会吧!素兰【音乐工厂】【WAV+CUE】
- 草蜢.1993-宝贝对不起(国)【宝丽金】【WAV+CUE】
- 杨培安.2009-抒·情(EP)【擎天娱乐】【WAV+CUE】
- 周慧敏《EndlessDream》[WAV+CUE]
- 彭芳《纯色角3》2007[WAV+CUE]
- 江志丰2008-今生为你[豪记][WAV+CUE]
- 罗大佑1994《恋曲2000》音乐工厂[WAV+CUE][1G]
- 群星《一首歌一个故事》赵英俊某些作品重唱企划[FLAC分轨][1G]
- 群星《网易云英文歌曲播放量TOP100》[MP3][1G]
- 方大同.2024-梦想家TheDreamer【赋音乐】【FLAC分轨】
- 李慧珍.2007-爱死了【华谊兄弟】【WAV+CUE】
- 王大文.2019-国际太空站【环球】【FLAC分轨】
- 群星《2022超好听的十倍音质网络歌曲(163)》U盘音乐[WAV分轨][1.1G]
- 童丽《啼笑姻缘》头版限量编号24K金碟[低速原抓WAV+CUE][1.1G]