一、解决的问题
1、统一标准
- 应用构建
- Java、C++、JavaScript
- 打成软件包
- .exe
- docker build .... 镜像
- 应用分享
- 所有软件的镜像放到一个指定地方 docker hub
- 安卓,应用市场
- 应用运行
- 统一标准的 镜像
- docker run
容器化
容器化
虚拟化技术:
1、基础镜像GB级别
2、创建使用稍微复杂
3、隔离性强
4、启动速度慢
5、移植与分享不方便
容器化技术:
1、基础镜像MB级别
2、创建简单
3、隔离性强
4、启动速度秒级
5、移植与分享方便
交互逻辑
装好Docker,然后去 软件市场 寻找镜像,下载并运行,查看容器状态日志等排错
其他系统参照如下文档
[root@master0-server ~]# yum remove docker \
> docker-client \
> docket-client-latest \
> docker-common \
> docker-latest \
> docker-latest-logrotate \
> docker-logrotate \
> docker-engine
No match for argument: docker
No match for argument: docker-client
No match for argument: docket-client-latest
No match for argument: docker-common
No match for argument: docker-latest
No match for argument: docker-latest-logrotate
No match for argument: docker-logrotate
No match for argument: docker-engine
No packages marked for removal.
Dependencies resolved.
Nothing to do.
Complete!
[root@master0-server ~]#
sudo yum install -y yum-utils
sudo yum-config-manager \
--add-repo \
http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@master1-server ~]# yum-config-manager \
> --add-repo \
> http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Invalid configuration value: failovermethod=priority in /etc/yum.repos.d/CentOS-Epel.repo; Configuration: OptionBinding with id "failovermethod" does not exist
Adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@master1-server ~]#
将 /etc/yum.repos.d/CentOS-Epel.repo
文件中 failovermethod=priority
注释掉。
[root@master1-server ~]# yum-config-manager \
> --add-repo \
> http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
[root@master1-server ~]#
sudo yum install -y docker-ce docker-ce-cli containerd.io
#以下是在安装k8s的时候使用
yum install -y docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io-1.4.6
systemctl enable docker --now
这里额外添加了docker的生产环境核心配置cgroup
{
"registry-mirrors": [
"https://061566c3360026b6dsa12210fe3c00517392e80.mirror.swr.myhuaweicloud.com"
]
}
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://061566c33600fdsfdsa423226b60fe3c00517392e80.mirror.swr.myhuaweicloud.com"],
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
[root@master1-server docker]# ll
total 8
-rw-r--r-- 1 root root 253 Apr 14 11:21 daemon.json
-rw------- 1 root root 244 Apr 14 11:02 key.json
[root@master1-server docker]#
[root@master1-server docker]#
[root@master1-server docker]# systemctl daemon-reload
[root@master1-server docker]# systemctl restart docker
[root@master1-server docker]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2022-04-14 11:25:59 CST; 7s ago
Docs: https://docs.docker.com
Main PID: 299884 (dockerd)
Tasks: 8
Memory: 40.9M
CGroup: /system.slice/docker.service
└─299884 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
Apr 14 11:25:58 master1-server dockerd[299884]: time="2022-04-14T11:25:58.998757809+08:00" level=info msg="ClientConn switching balancer to \"pick_fi>
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.026125032+08:00" level=warning msg="Your kernel does not support cgroup blk>
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.026141924+08:00" level=warning msg="Your kernel does not support cgroup blk>
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.026233315+08:00" level=info msg="Loading containers: start."
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.131937408+08:00" level=info msg="Default bridge (docker0) is assigned with >
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.174945485+08:00" level=info msg="Loading containers: done."
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.191440293+08:00" level=info msg="Docker daemon" commit=b0f5bc3 graphdriver(>
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.191484627+08:00" level=info msg="Daemon has completed initialization"
Apr 14 11:25:59 master1-server systemd[1]: Started Docker Application Container Engine.
Apr 14 11:25:59 master1-server dockerd[299884]: time="2022-04-14T11:25:59.218406423+08:00" level=info msg="API listen on /var/run/docker.sock"
lines 1-20/20 (END)
【与云原生的故事】有奖征文火热进行中:https://bbs.huaweicloud.com/blogs/345260
评论(0)