docker 学习第一篇 Linux 安装docker
1、下载docker ,下载地址https://docs.docker.com/engine/install/centos/
2、卸载旧的docker,
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
3、
Set up the repository
Install the yum-utils
package (which provides the yum-config-manager
utility) and set up the repository.
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
记录解决yum报错:Cannot retrieve metalink for repository: epel/x86_64
解决方法可以试试修改“/etc/yum.repos.d”文件夹中的“epel.repo”文件。修改内容如下:
我们只需要把“metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch”前面加“#”号注释掉,并且把“#baseurl=http://download.fedoraproject.org/pub/epel/7/$basearch”取消注释!修改如下即可,一般这个问题就能得到解决了。
4、安装镜像
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
5、启动docker
sudo systemctl start docker
6、检查版本
docker version
7、运行镜像
sudo docker run hello-world
8、设置阿里云镜像加速器
https://cr.console.aliyun.com/cn-hangzhou/instances/mirrors
sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon.json <<-'EOF' { "registry-mirrors": ["https://5yfoi1k1.mirror.aliyuncs.com"] } EOF sudo systemctl daemon-reload sudo systemctl restart docker
11、常见错误
Docker Unable to load the service index for source https://api.nuget.org/v3/index.json
1、解决方案从新安装docker
2、安装证书等等一大堆
Get "https://mcr.microsoft.com/v2/": x509: certificate signed by unknown authority
1、安装证书
yum install ca-certificates
2、更新证书
update-ca-trust enable
posted on 2022-08-23 22:41 topguntopgun 阅读(45) 评论(0) 编辑 收藏 举报