Solve the problem of docker x509 secure registry


After installing docker, we encountered x509 problem when trying to pull docker from harbor, a private server built by the company. The reason for this problem is that docker will verify the certificate of the website, and the private server does not have the corresponding certificate, so docker refused to visit, but we can also allow docker to connect to “unsafe” websites ourselves. Here is the solution:

Environment: Ubuntu 16.04, docker CE 18.09

To modify or create a new profile:

sudo vim /etc/default/docker 

Enter I to switch to edit mode and enter docker_ Opts = “– secure registry″ (replace with the URL you need to allow. If there is a port number, you need to add the port number, such as,: WQ save and exit:


Edit the docker service configuration file:

sudo vim /lib/systemd/system/docker.service

In the command mode: / execstart, find execstart. My default execstart is as follows: execstart = / usr / bin / dockerd – H UNIX://

Add environmentfile (note that there is a “-” before the file path name, and it is recommended to copy my configuration directly) and modify execstart, save and exit:

ExecStart=/usr/bin/dockerd -H unix:// $DOCKER_OPTS

Refresh the service configuration and restart the docker:

systemctl daemon-reload
service docker restart

After that, docker pull can be used normally.

Supplement: added in docker version 1.13.1 — secure registry

There are three steps (add the content in the red box: the IP needs to be changed)

1、vi /etc/sysconfig/docker

2、 vi /usr/lib/systemd/system/docker.service

3、vi /etc/docker/daemon.json

The above is my personal experience. I hope I can give you a reference, and I hope you can support developpaer. If there are mistakes or not fully considered, please don’t hesitate to comment.

Recommended Today

A front-end developer's Vim is the same as an IDE

Here is my new configurationjaywcjlove/vim-webI've been grinding it, and it's basically ready to use. Take it out and cheat the star Install The latest version of Vim 7.4+ uses (brew install macvim) installation, vim version updatebrew install macvim –override-system-vim View configuration locations # Enter vim and enter the following characters :echo $MYVIMRC download vim-web Download […]