Use daemon.json everywhere possible (#3252)

This commit is contained in:
Misty Stanley-Jones 2017-05-15 10:44:40 -07:00 committed by GitHub
parent eb2763d826
commit ed56794d56
2 changed files with 91 additions and 50 deletions

View file

@ -54,7 +54,7 @@ remote fetch and local re-caching.
To ensure best performance and guarantee correctness the Registry cache should
be configured to use the `filesystem` driver for storage.
## Running a Registry as a pull through cache
## Run a Registry as a pull-through cache
The easiest way to run a registry as a pull through cache is to run the official
Registry image.
@ -63,7 +63,7 @@ Multiple registry caches can be deployed over the same back-end. A single
registry cache will ensure that concurrent requests do not pull duplicate data,
but this property will not hold true for a registry cache cluster.
### Configuring the cache
### Configure the cache
To configure a Registry to run as a pull through cache, the addition of a
`proxy` section is required to the config file.
@ -71,26 +71,32 @@ To configure a Registry to run as a pull through cache, the addition of a
In order to access private images on the Docker Hub, a username and password can
be supplied.
proxy:
remoteurl: https://registry-1.docker.io
username: [username]
password: [password]
```yaml
proxy:
remoteurl: https://registry-1.docker.io
username: [username]
password: [password]
```
> :warn: if you specify a username and password, it's very important to understand that private resources that this user has access to on the Hub will be made available on your mirror. It's thus paramount that you secure your mirror by implementing authentication if you expect these resources to stay private!
> **Warning**: If you specify a username and password, it's very important to
> understand that private resources that this user has access to Docker Hub will
> be made available on your mirror. **You must secure your mirror** by
> implementing authentication if you expect these resources to stay private!
> :warn: in order for the scheduler to clean up old entries, delete must be enabled in the registry configuration. See the [Registry Configuration Reference](../configuration.md) for more details.
> **Warning**: In order for the scheduler to clean up old entries, `delete` must
> be enabled in the registry configuration. See
> [Registry Configuration](/registry/configuration.md) for more details.
### Configuring the Docker daemon
### Configure the Docker daemon
You will need to pass the `--registry-mirror` option to your Docker daemon on
startup:
Either pass the `--registry-mirror` option when starting `dockerd` manually,
or edit `/etc/docker/daemon.json` and add the `registry-mirrors` key and value,
to make the change persistent.
docker --registry-mirror=https://<my-docker-mirror-host> daemon
```json
{
"registry-mirrors": ["https://<my-docker-mirror-host>"]
}
```
For example, if your mirror is serving on `http://10.0.0.2:5000`, you would run:
docker --registry-mirror=https://10.0.0.2:5000 daemon
> NOTE: Depending on your local host setup, you may be able to add the
`--registry-mirror` option to the `DOCKER_OPTS` variable in
`/etc/default/docker`.
Save the file and restart Docker for the change to take effect.