HowTo: Add custom headers to docker client requests
It is possible to add custom http header Show archive.org snapshot to request made by the docker CLI client. This can be used to e.g. add another authentication header for a proxy.
Implementation
config.json
Add an entry to ~/.docker/config.json
:
{
"HttpHeaders": {
"X-Meta-$YOURKEY": "SomeValue"
}
}
Environment Variable (Experimental)
Warning
Requires version v27.1 or higher.
Set DOCKER_CUSTOM_HEADERS
,
must be provided as a comma-seperated list of name=value
pairs
Show archive.org snapshot
.
Caveats:
- The
X-Meta-
prefix for the header name is undocumented but required, Show archive.org snapshot , if not set docker won't send the header. - It works for
docker pull
anddocker push
, but not for other commands likedocker build
ordocker login
.