From 4a8060f08bd5b472eddb1ee52d5339fc014dd5a0 Mon Sep 17 00:00:00 2001 From: Yanqiang Miao Date: Wed, 7 Mar 2018 17:00:32 +0800 Subject: [PATCH] Add document about registry configuration Signed-off-by: Yanqiang Miao --- docs/registry.md | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 docs/registry.md diff --git a/docs/registry.md b/docs/registry.md new file mode 100644 index 000000000..2e2236d82 --- /dev/null +++ b/docs/registry.md @@ -0,0 +1,56 @@ +# Configure Image Registry for CRI-containerd +This document describes the methods to configure the image registry for `cri-containerd`. + +In `cri-containerd`, `docker.io` is the default image registry. You can also set up other image registries similar to docker. `cri-containerd` provides two ways to set up the image registry. + + + +## Configure Image Registry with `--registry` Option + +Start `cri-containerd` with `--registry` option like: +```bash +$ cri-containerd \ + --registry=test.secure-registry.io=https://HostIP1:Port1 \ + --registry=test.insecure-registry.io=http://HostIP2:Port2 +``` + +If you want configure a insecure registry, you need set the endpoint with `http://` prefix. If you want to configure a secure registry, you need set the endpoint with `https://` prefix. + +This method is only suitable for standalone mode. + + +## Configure Image Registry with Config File in Standalone Mode +In standalone mode, `cri-containerd` also specifies registris using the configuration file located in `/etc/cri-containerd/config.toml`. You can set registries in the configuration file as follows: +```toml +[registry.mirrors] + [registry.mirrors."docker.io"] + endpoint = ["https://registry-1.docker.io"] + [registry.mirrors."test.secure-registry.io"] + endpoint = ["https://HostIP1:Port1"] + [registry.mirrors."test.insecure-registry.io"] + endpoint = ["http://HostIP2:Port2"] +``` + +In the same way, the default configuration also can be generated by `cri-containerd default-config > /etc/cri-containerd/config.toml`. + +The endpoint is a list that can contain multiple image registry URLs splited by commas. + +After modify the config file, you need restart the `cri-containerd` service. + +## Configure Image Registry with Config File in CRI Plugin Mode +Today, `cri-containerd` can also be used as a native plugin of `containerd`. In this mode, you should set registries in `/etc/containerd/config.toml` as follows: +```toml +[plugins.cri.registry.mirrors] + [plugins.cri.registry.mirrors."docker.io"] + endpoint = ["https://registry-1.docker.io"] + [plugins.cri.registry.mirrors."test.secure-registry.io"] + endpoint = ["https://HostIP1:Port1"] + [plugins.cri.registry.mirrors."test.insecure-registry.io"] + endpoint = ["http://HostIP2:Port2"] +``` + +The default configuration can be generated by `containerd config default > /etc/containerd/config.toml`. + +The endpoint is a list that can contain multiple image registry URLs splited by commas. + +After modify the config file, you need restart the `containerd` service.