Centos7.9安装Docker
内核配置:
下载地址:http://193.49.22.109/elrepo/kernel/
本次内核升级选用的版本:
kernel-ml-4.20.13-1.el7.elrepo.x86_64.rpm
kernel-ml-devel-4.20.13-1.el7.elrepo.x86_64.rpm
将以上文件上传至服务器中(root家目录中,cd ~):
安装内核:
# cd /root && yum localinstall -y kernel-ml*
更改内核启动顺序:
# grub2-set-default 0 && grub2-mkconfig -o /etc/grub2.cfg # grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
查看当前内核是否是新内核:
# grubby --default-kernel /boot/vmlinuz-4.19.12-1.el7.elrepo.x86_64
安装前卸载旧版本docker:
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
安装yum-utils包(提供yum-config-manager实用程序)并设置稳定的存储库
# sudo yum install -y yum-utils # sudo yum-config-manager \ --add-repo \ https://download.docker.com/linux/centos/docker-ce.repo
# sudo yum-config-manager --add-repo \ http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
如果系统为Fedora ,可采用下面的源:
https://mirrors.aliyun.com/docker-ce/linux/fedora/docker-ce.repo
# sudo yum install docker-ce docker-ce-cli containerd.io
查看版本:
# docker --version
配置镜像镜像加速:
添加daemon.json 文件, vi /etc/docker/daemon.json
{ "registry-mirrors": ["http://hub-mirror.c.163.com"] }
# systemctl daemon-reload
# systemctl restart docker
最后:
# systemctl start docker # systemctl enable docker Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
验证docker是否正常安装:
# docker run hello-world Unable to find image 'hello-world:latest' locally latest: Pulling from library/hello-world 719385e32844: Pull complete Digest: sha256:fc6cf906cbfa013e80938cdf0bb199fbdbb86d6e3e013783e5a766f50f5dbce0 Status: Downloaded newer image for hello-world:latest Hello from Docker! This message shows that your installation appears to be working correctly. To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. (amd64) 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal. To try something more ambitious, you can run an Ubuntu container with: $ docker run -it ubuntu bash Share images, automate workflows, and more with a free Docker ID: https://hub.docker.com/ For more examples and ideas, visit: https://docs.docker.com/get-started/
版权声明:本文由老瓦罐儿煨汤发布,如需转载请注明出处。