A simple way to access Docker's remote API
1M+
The current recommendation to enable Docker's remote API is to change the daemon configuration and then restart. With Sherpa, you simply need to run the container and you'll have access to the docker.sock via TCP.
Sherpa has two access modes, --allow and --deny(default). In allow mode, access to the Docker API is implicitly allowed. Meaning, you must explicitly define endpoints and HTTP methods that are forbidden. In --deny mode, the default mode, the reverse is true: access to the API is implicitly forbidden. Paths must be explicitly defined.
Paths can be configured using the $CONFIG environment variable with a json blob passed in and/or by mounting config files to /etc/sherpa. This blob has the following schema:
[
{
"Path" : "STRING",
"Access": "allow|deny",
"Methods": ["STRING"],
"Addresses": ["STRING"]
}
]
Admins can also restrict access to Sherpa by using a combination of volume mounting permissions and IP binding.
Multiple ACLs can be defined to create a strictly contained remote API. Here are a few examples:
docker run -d \
--name sherpa \
-v /var/run/docker.sock:/tmp/docker.sock \
-p 4550:4550 \
djenriquez/sherpa --allow
docker run -d \
--name sherpa \
-e CONFIG='[
{
"Path" : "/containers/json",
"Access": "allow",
"Methods": ["GET"]
}
]' \
-v /var/run/docker.sock:/tmp/docker.sock \
-p 4550:4550 \
djenriquez/sherpa
docker run -d \
--name sherpa \
-e CONFIG='[
{
"Path" : "/containers/*/kill",
"Access": "deny"
}
]' \
-v /var/run/docker.sock:/tmp/docker.sock \
-p 4550:4550 \
djenriquez/sherpa --allow
docker run -d \
--name sherpa \
-e CONFIG='[
{
"Path" : "/containers/json",
"Access": "deny"
}
]' \
-v `pwd`/examples:/etc/sherpa \
-v /var/run/docker.sock:/tmp/docker.sock \
-p 4550:4550 \
djenriquez/sherpa --allow
docker run -d \
--name sherpa \
-e CONFIG='[
{
"Path" : "/",
"Access": "allow",
"Addresses": ["10.0.0.0/8", "192.168.0.0/16", "172.0.0.0/8"]
}
]' \
-v /var/run/docker.sock:/tmp/docker.sock \
-p 4550:4550 \
djenriquez/sherpa --allow
Content type
Image
Digest
Size
91.9 MB
Last updated
almost 10 years ago
docker pull djenriquez/sherpa