Docker Transport
The Docker transport resolves a container’s IP address via the Docker Engine API and sends requests directly to it, no port mapping required.
When to use
Section titled “When to use”- Agents running inside Docker containers on the same host
- When you don’t want to publish container ports to the host
Registration
Section titled “Registration”society onboardAgent name: docker-echoDescription: Echo agent in a containerTransport [http/ssh/docker/stdio] (http): dockerContainer name or ID: echo-agentAgent port (8080): 8001Docker network (optional): society-netDocker socket path (/var/run/docker.sock):Registry entry
Section titled “Registry entry”{ "name": "docker-echo", "url": "http://echo-agent:8001", "transport": { "type": "docker", "config": { "container": "echo-agent", "agent_port": "8001", "network": "society-net", "socket_path": "/var/run/docker.sock" } }}Config reference
Section titled “Config reference”| Key | Required | Default | Description |
|---|---|---|---|
container | Yes | — | Container name or ID |
agent_port | No | 8080 | Port the agent listens on inside the container |
network | No | (first available) | Docker network to resolve IP from |
socket_path | No | /var/run/docker.sock | Path to Docker socket |
How it works
Section titled “How it works”- Calls
GET /containers/<name>/jsonon the Docker socket - Verifies the container is running
- Resolves the container’s IP address on the specified network (or first available)
- Sends HTTP POST to
http://<container-ip>:<agent_port>
Example: run an agent in Docker
Section titled “Example: run an agent in Docker”# Build the imagedocker build -t society .
# Create a networkdocker network create society-net
# Run an echo agentdocker run -d --name echo-agent --network society-net \ society run --config /etc/society/agents/echo.yaml
# Register it locallysociety onboard# name: docker-echo, transport: docker, container: echo-agent, port: 8001
# Testsociety send docker-echo "hello from outside"Troubleshooting
Section titled “Troubleshooting”“container not running”:
Check docker ps to see if the container is up.
“no IP found on network”:
The container isn’t attached to the specified network. Check with docker inspect echo-agent.
Permission denied on Docker socket:
Your user needs access to /var/run/docker.sock. Either add yourself to the docker group or use socket_path to point to a rootless Docker socket.