目录
简介
Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的 Linux或Windows操作系统的机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。
组成:
DockerClient客户端
Docker Daemon守护进程
Docker Image镜像
DockerContainer容器
虚拟机体系结构和docker对比
虚拟机
docker:
虚拟机重开了系统,再次构建应用
容器直接共享主机
工作原理
rhel7.6 docker-ce的安装
软件仓库配置
curl https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O
生成repo文件
也可以用阿里云镜像中的如图标记命令
只要stable,gpgcheck=0
[root@vm2 yum.repos.d]# cat /etc/yum.repos.d/docker-ce.repo
[docker-ce-stable]
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable
enabled=1
gpgcheck=0
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg[root@vm2 yum.repos.d]#
这时候下载会有依赖性,需要centos的镜像仓库
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o/O
o需要指定位置名称
修改centos.repo文件
其他enable=0 extra如图
安装
yum install -y docker-ce
开启,查看
systemctl enable --now docker
docker info
打开桥接
[root@vm2 docker]# sysctl -a | grep bridge-nf-call-iptables
net.bridge.bridge-nf-call-iptables = 0
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.docker0.stable_secret"
sysctl: reading key "net.ipv6.conf.eth0.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
[root@vm2 docker]# vim /etc/sysctl.d/docker.conf
[root@vm2 docker]# cat /etc/sysctl.d/docker.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1