建设企业高端网站,如何做网站域名解析,布吉个人网站建设,公司网站公司简介笔记/朱季谦
以下是笔者本人学习搭建docker过程当中记录的一些实践笔记#xff0c;过程当中也遇到了一些坑#xff0c;但都解决了#xff0c;就此记录#xff0c;留作以后再次搭建时可以直接参考。
一、首先#xff0c;先检查CentOS版本#xff0c;保证在CentOS7版本以…笔记/朱季谦
以下是笔者本人学习搭建docker过程当中记录的一些实践笔记过程当中也遇到了一些坑但都解决了就此记录留作以后再次搭建时可以直接参考。
一、首先先检查CentOS版本保证在CentOS7版本以上系统内核在3.10以上——
[root192 opt]# uname -r
3.10.0-693.el7.x86_64二、卸载旧的docker版本
sudo yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-engine三、安装需要的依赖包
sudo yum install -y yum-utils四、设置国内镜像的仓库
sudo yum-config-manager \--add-repo \http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo五、更新yum软件包索引
yum makecache fast 六、安装docker相关 docker-ce 社区 docker ee企业版
sudo yum install docker-ce docker-ce-cli containerd.io七、启动docker
systemctl start docker这时出现了一个很奇怪的异常
Job for docker.service failed because the control process exited with error code. See systemctl status docker.service and journalctl -xe for details.
不慌我们先检查一下daemon.json文件格式
vim /etc/docker/daemon.json发现这个daemon.json文件里是这样的也不知道为啥直接更新下载后它会缺少了部分字符...... 需要修改成这样就可以了
{registry-mirrors: [http://9600955f.m.daocloud.io],insecure-registries: []
}接下来可以正常启动docker了——
[root192 opt]# systemctl daemon-reload
[root192 opt]# systemctl start docker如果不报错输入systemctl status docker.service若显示以下信息则证明启动安装并启动成功 安装成功后使用docker version一般会出现以下信息
[root192 opt]# docker version
Client: Docker Engine - CommunityVersion: 20.10.8API version: 1.41Go version: go1.16.6Git commit: 3967b7dBuilt: Fri Jul 30 19:55:49 2021OS/Arch: linux/amd64Context: defaultExperimental: trueServer: Docker Engine - CommunityEngine:Version: 20.10.8API version: 1.41 (minimum version 1.12)Go version: go1.16.6Git commit: 75249d8Built: Fri Jul 30 19:54:13 2021OS/Arch: linux/amd64Experimental: falsecontainerd:Version: 1.4.9GitCommit: e25210fe30a0a703442421b0f60afac609f950a3runc:Version: 1.0.1GitCommit: v1.0.1-0-g4144b63docker-init:Version: 0.19.0GitCommit: de40ad0尝试下拉取hello-world时发现出现一个超时问题
[root192 opt]# docker run hello-world
Unable to find image hello-world:latest locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/hello-world/manifests/sha256:393b81f0ea5a98a7335d7ad44be96fe76ca8eb2eaa76950eb8c989ebf2b78ec0: net/http: TLS handshake timeout.
See docker run --help.这时需要把daemon.json文件里的信息改一下改成国内阿里云镜像配置可以提高拉取速度避免超时问题如下
{registry-mirrors: [https://6kx4zyno.mirror.aliyuncs.com],insecure-registries: []
}接着重启systemctl restart docker即可。
[root192 opt]# sudo systemctl restart docker再试着执行docker run hello-world这次就正常了
[root192 opt]# docker run hello-world
Unable to find image hello-world:latest locally
latest: Pulling from library/hello-world
2db29710123e: Pull complete
Digest: sha256:393b81f0ea5a98a7335d7ad44be96fe76ca8eb2eaa76950eb8c989ebf2b78ec0
Status: Downloaded newer image for hello-world:latestHello from Docker!
This message shows that your installation appears to be working correctly.查看一下是否已经成功下载hello-world镜像可以看到hello-world镜像已经被拉到了docker当中
root192 opt]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
hello-world latest feb5d9fea6a5 40 hours ago 13.3kB
nginx latest f35646e83998 11 months ago 133MB
ubuntu latest 549b9b86cb8d 21 months ago 64.2MB