docker常见错误
push报错
docker客户端执行push命令报错
Pushing image '192.168.14.226:5000/xxx/yyy:v0.1.6-dev' ...
The push refers to a repository [192.168.14.226:5000/xxx/yyy:v0.1.6-dev]
Get https://192.168.14.226:5000/v1/_ping: http: server gave HTTP response to HTTPS client
解决:
因为客户端所在服务器没有默认使用https请求docker register私服,设置为信任库,http方式请求即可
docker 1.12.x
在启动时的配置参数即可,多个私库配置多个即可
--insecure-registry 192.168.14.226:5000
#多个
--insecure-registry 192.168.14.226:5000 --insecure-registry 192.168.14.227:5000
docker 1.17.x 以上新版本
在”/etc/docker/“目录下,创建”daemon.json“文件。在文件中写入:
{ "insecure-registries":["192.168.1.100:5000"] }
#多个
{ "insecure-registries":["192.168.1.100:5000", "192.168.1.101:5000"] }
docker 1.13.1 yum安装
在docker.service中配置对应的参数即可,或者/run/containers/registries.conf,如$REGISTRIES对应的 REGISTRIES
[root@docker110 ~]# cat /usr/lib/systemd/system/docker.service定义对应的环境变量
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=network.target
Wants=docker-storage-setup.service
Requires=docker-cleanup.timer
[Service]
Type=notify
NotifyAccess=main
EnvironmentFile=-/run/containers/registries.conf
EnvironmentFile=-/etc/sysconfig/docker
EnvironmentFile=-/etc/sysconfig/docker-storage
EnvironmentFile=-/etc/sysconfig/docker-network
Environment=GOTRACEBACK=crash
Environment=DOCKER_HTTP_HOST_COMPAT=1
Environment=PATH=/usr/libexec/docker:/usr/bin:/usr/sbin
ExecStart=/usr/bin/dockerd-current \
--add-runtime docker-runc=/usr/libexec/docker/docker-runc-current \
--default-runtime=docker-runc \
--exec-opt native.cgroupdriver=systemd \
--userland-proxy-path=/usr/libexec/docker/docker-proxy-current \
--init-path=/usr/libexec/docker/docker-init-current \
--seccomp-profile=/etc/docker/seccomp.json \
$OPTIONS \
$DOCKER_STORAGE_OPTIONS \
$DOCKER_NETWORK_OPTIONS \
$ADD_REGISTRY \
$BLOCK_REGISTRY \
$INSECURE_REGISTRY \
$REGISTRIES
ExecReload=/bin/kill -s HUP $MAINPID
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
TimeoutStartSec=0
Restart=on-abnormal
KillMode=process
[Install]
WantedBy=multi-user.target