赞
踩
官网:https://www.docker.com
文档地址:https://docs.docker.com 超级详细的docker文档
仓库地址:https://hub.docker.com push pull 镜像发布
- # 查看系统内核和操作系统版本
- [root@root]# uname -r
- 4.18.0-193.el8.x86_64
- [root@root]# cat /etc/redhat-release
- CentOS Linux release 8.2.2004 (Core)
- [root@root]# yum remove docker \
- docker-client \
- docker-client-latest \
- docker-common \
- docker-latest \
- docker-latest-logrotate \
- docker-logrotate \
- docker-engine
[root@root]# sudo yum install -y yum-utils
- [root@root]# sudo yum-config-manager \
- https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
配置CentOS8的yum源,参考:CentOS8 配置阿里云的yum源 - 简书
[root@root]# sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
查看官方帮助文档:https://docs.docker.com/engine/install/centos/
conflicting requests - nothing provides container-selinux >= 2:2.74 needed by containerd
原因:container-selinux没有安装或者版本太低
解决方案:下载对应的 rpm 包,并且安装
- [root@root]# wget https://vault.centos.org/centos/8/AppStream/x86_64/os/Packages/container-selinux-2.124.0-1.gitf958d0c.module_el8.3.0+569+1bada2e4.noarch.rpm
- [root@root]# rpm -ivh container-selinux-2.124.0-1.gitf958d0c.module_el8.3.0+569+1bada2e4.noarch.rpm
版本下载地址 https://pkgs.org/download/container-selinux
- [root@root]# docker --version
- Docker version 20.10.17, build 100c701
[root@root]# systemctl status docker
- [root@root]# docker run hello-world
- #本地没有找到hello-world的镜像
- Unable to find image 'hello-world:latest' locally
- # 去下载最新的hello-world镜像
- latest: Pulling from library/hello-world
- #下载成功
- 2db29710123e: Pull complete
- Digest: sha256:13e367d31ae85359f42d637adf6da428f76d75dc9afeb3c21faea0d976f5c651
- Status: Downloaded newer image for hello-world:latest
- #看见这句,说明docker已安装成功
- Hello from Docker!
- This message shows that your installation appears to be working correctly.
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
原因:docker宕机
- [root@root]# systemctl status docker
- ● docker.service - Docker Application Container Engine
- Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
- Active: inactive (dead)
- Docs: https://docs.docker.com
[root@root]# systemctl enable docker
[root@root]# systemctl restart docker
- [root@root]# 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 Fri 2024-05-31 14:10:28 CST; 7s ago
- Docs: https://docs.docker.com
- Main PID: 912446 (dockerd)
- Tasks: 8
- Memory: 30.2M
- CGroup: /system.slice/docker.service
- └─912446 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
- [root@root]# docker images
- REPOSITORY TAG IMAGE ID CREATED SIZE
- hello-world latest feb5d9fea6a5 9 months ago 13.3kB
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。