Configuring Docker to allow insecure registries

The Docker Engine can use a JSON configuration file to change settings, including the list of insecure registries that the engine will allow. Any registry domains in that list can use HTTP rather than HTTPS, so this is not something you should do for a registry that's hosted on a public network.

Docker's configuration file is located at %programdata%dockerconfigdaemon.json (daemon is Linux terminology for a background service, so this is the name of the Docker Engine configuration file). You can manually edit it to add the local registry as a secure option and then restart the Docker Windows service. This configuration allows Docker to use the local registry with HTTP:

{  
"insecure-registries": [
"registry.local:5000"
]
}

If you're using Docker Desktop on Windows 10, the UI has a nice configuration window that takes care of this for you. Instead of editing the file manually, just right-click on the Docker logo in the status bar, select Settings, navigate to the Daemon page, and add an entry to the Insecure registries list:

With the local registry domain added to my insecure list, I can use it to push and pull images:

> docker image push registry.local:5000/infrastructure/registry:v2.6.2

The push refers to repository [registry.2019:5000/infrastructure/registry]
dab5f9f9b952: Pushed
9ab5db0fd189: Pushed
c53fe60c877c: Pushed
ccc905d24a7d: Pushed
470656dd7daa: Pushed
f32c8541ff24: Pushed
3ad7de2744af: Pushed
b9fa4df06e58: Skipped foreign layer
37c182b75172: Skipped foreign layer
v2.6.2: digest: sha256:d7e87b1d094d96569b346199c4d3dd5ec1d5d5f8fb9ea4029e4a4aa9286e7aac size: 2398

Any users with network access to my Docker server can use images stored in the local registry with the docker image pull or docker container run commands. You can also use local images as the base images in other Dockerfiles by specifying the name with the registry domain, the repository name, and the tag in the FROM instruction:

FROM registry.local:5000/infrastructure/registry:v2.6.2
CMD ["cmd /s /c", "echo", "Hello from Chapter 4."]
There is no way to override the default registry, so you can't set your local registry as the default when a domain isn't specified  the default is always Docker Hub. If you want to use a different registry for images, the registry domain always has to be specified in the image name. Any image names you use without a registry address will be assumed to refer to images from docker.io.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.206.225