Docker错误集

1.镜像删除不掉

 删除本地一些镜像时,发现删不掉,经查看,是因为带有标签,且IMAGE ID 相同,共用了镜像,所以删除不掉。

解决方法:

1.去除TAG标签Docker错误集_第1张图片

[root@node1 static_web]# docker rmi c740b6d3361d
Error response from daemon: conflict: unable to delete c740b6d3361d (must be forced) - image is referenced in multiple repositories

#用docker rmi REPOSITORY:TAG即可去除标签
[root@node1 static_web]# docker rmi 192.168.231.130:5000/realxw/static_web:v1
Untagged: 192.168.231.130:5000/realxw/static_web:v1
[root@node1 static_web]# docker rmi 192.168.231.130:5000/realxw/static_web:v1
Untagged: 192.168.231.130:5000/realxw/static_web:v1
[root@node1 static_web]# docker rmi node1:5000/realxw/static_web:v1
Untagged: node1:5000/realxw/static_web:v1

#删除本地image
docker rmi c740b6d3361d

2.用-f,强制删除镜像

[root@node1 static_web]# docker images
REPOSITORY                               TAG                 IMAGE ID            CREATED             SIZE
realxw/static_web                        latest              c740b6d3361d        32 minutes ago      312 MB
192.168.231.130:5000/realxw/static_web   v1                  c740b6d3361d        32 minutes ago      312 MB
docker.io/registry                       2                   f32a97de94e1        2 days ago          25.8 MB
docker.io/registry                       latest              f32a97de94e1        2 days ago          25.8 MB
docker.io/ubuntu                         latest              47b19964fb50        4 weeks ago         88.1 MB
docker.io/centos                         latest              1e1148e4cc2c        3 months ago        202 MB
docker.io/ubuntu                         12.04               5b117edd0b76        23 months ago       104 MB
docker.io/fedora                         20                  ba74bddb630e        2 years ago         291 MB
#强制删除
[root@node1 static_web]# docker rmi -f c740b6d3361d
Untagged: 192.168.231.130:5000/realxw/static_web:v1
Untagged: realxw/static_web:latest
Deleted: sha256:c740b6d3361debab79bf5b8108497b47dad1feb66587e4d889abbb9b5c97e0cf
Deleted: sha256:9b42b366d114d26eb334f139b71b50e09dc18f91d4c86a237d4e86ac8f9d797d
Deleted: sha256:9b4c29a733ee88737e66cfcff611aa8346f6392ec9ec67124117f23efbf81c24
Deleted: sha256:e6213022e0e7b1c49e78000e7b0470fc33777a14fc3f787056b9e037cc9eaef0
Deleted: sha256:0cddd2610a15224ddaf66c2966ec3b9219075dec1a25111814879af24441ce0b

2.yum安装指定版本Docker

#查看docker版本号
[root@n1 ~]# yum list docker-ce --showduplicates | sort -r

#安装指定版本
[root@n1 ~]# yum install docker-ce-18.06.3.ce-3.el7 -y

3.docker  push 出现HTTPS错误

push镜像出现如下错误,是因为要设置HTTPS,也可以不设置。

[root@node1 ~]# docker push 192.168.231.130:5000/web:v1
The push refers to repository [192.168.231.130:5000/web]
Get https://192.168.231.130:5000/v2/: http: server gave HTTP response to HTTPS client

解决方法:

[root@node1 ~]# vim /etc/docker/daemon.json

{
"registry-mirrors": ["https://registry.docker-cn.com"],

#添加不安全的registires,后边添加主机名或IP地址和端口号
"insecure-registries": ["192.168.231.130:5000"]
}

#重启服务

[root@node1 ~]# systemctl restart docker

#上传镜像

[root@node1 ~]# docker push 192.168.231.130:5000/web:v1
The push refers to repository [192.168.231.130:5000/web]
df0fd7bba19a: Pushed
adab5d09ba79: Pushed
v1: digest: sha256:4840765a879ba810bd7ba790de9fdbba3ae4a1b7e677af07f3ff4d5d34addc85 size: 734

 

你可能感兴趣的:(Docker)