Getting Started¶
This guide will help you get started with Docker Socket Proxy.
Prerequisites¶
- Docker installed and running
- Basic understanding of Docker and its API
- Administrative privileges (for creating and managing sockets)
Installation¶
Grab the latest release from GitHub and move it to a directory in your PATH:
curl -sSL https://github.com/js-murph/docker-socket-proxy/releases/latest/download/docker-socket-proxy.tgz
tar -xzf docker-socket-proxy.tgz
mv docker-socket-proxy /usr/local/bin/docker-socket-proxy
Running the Daemon¶
The Docker Socket Proxy daemon is the core service that manages proxy sockets. Start it with:
This will:
- Create the socket directory at
/var/run/docker-proxy/
- Start the management socket at
/var/run/docker-proxy/management.sock
- Begin listening for socket creation/deletion requests
For production use, you may want to run the daemon as a systemd service. An example service file is provided in the repository at examples/docker-socket-proxy.service
.
Creating Your First Proxy Socket¶
- Create a configuration file (e.g.,
config.yaml
):
config:
propagate_socket: "/var/run/docker.sock"
rules:
- match:
path: "/v1.*/volumes"
method: "GET"
actions:
- action: "deny"
reason: "Listing volumes is restricted"
- match:
path: "/v1.*/containers/create"
method: "POST"
actions:
- action: "upsert"
update:
Env:
- "FUN=yes"
- action: "replace"
contains:
Env:
- "DEBUG=true"
update:
Env:
- "DEBUG=false"
- action: "delete"
contains:
Env:
- "PANTS=.*"
- Create the proxy socket:
The command will output the path to your new proxy socket, typically something like:
Using the Proxy Socket¶
You can now use this socket with Docker CLI or any other Docker client:
Or with Docker Compose by setting the DOCKER_HOST
environment variable:
Managing Proxy Sockets¶
List all available proxy sockets:
View the configuration of a specific socket:
Delete a socket when you no longer need it:
Next Steps¶
Now that you have a basic proxy socket running, you can:
- Learn more about configuration options
- Explore advanced rule configurations
- Check the CLI reference for all available commands