一 docker简介
架构图
1 什么是Docker
- Docker 是一个开源的应用容器引擎,基于 Go 语言并遵从 Apache2.0 协议开源;
- Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级、可移植的容器中,然后发布到任何流行的 Linux 机器上,也可以实现虚拟化;
- 容器是完全使用沙箱机制,相互之间不会有任何接口,更重要的是容器性能开销极低;
- Docker 从 17.03 版本之后分为 CE(Community Edition-社区版)和 EE(Enterprise Edition-企业版)。
2 Docker的应用场景
- Web应用的自动化打包和发布,自动化测试和持续集成、发布;
- 在服务型环境中部署和调整数据库或其他的后台应用;
- 从头编译或者扩展现有的 OpenShift 或 Cloud Foundry 平台来搭建自己的 PaaS 环境。
3 友情链接
二 安装
1 编写yum源
[root@server1 ~]# vim /etc/yum.repos.d/dvd.repo
[root@server1 ~]# cat /etc/yum.repos.d/dvd.repo
[dvd]
name=dvd
baseurl=http://172.25.7.250/rhel7.6
gpgcheck=0
[docker]
name=docker
baseurl=http://172.25.7.250/docker-ce
gpgcheck=0
2 安装docker-ce
[root@server1 ~]# yum install -y docker-ce
3 启动服务
root@server1 ~]# systemctl enable --now docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
4 查看docker信息
[root@server1 ~]# docker info
Client:
Debug Mode: false
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.15
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05f951a3781f4f2c1911b05e61c160e9c30eaa8e
runc version: 12644e614e25b05da6fd08a38ffa0cfe1903fdec
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-957.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.6 (Maipo)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.795GiB
Name: server1
ID: 2FNT:DSJG:7QEX:LGQA:EOGT:KKGC:LNCR:LR6J:YQNV:BJL3:A6K2:N64X
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
出现警告:
处理警告问题:
在/etc/sysctl.d/下编辑 docker.con