Linking Containers via Docker Remote API
docker
Solution
In the current (1.8) API, the `-name` flag is passed as a query string to `POST /v1.8/containers/create` – i.e. like this:
POST /v1.8/containers/create?name=redis_ambassador
(POST body left out for brevity)
I figured this out by using Geoffrey Bachelet's excellent suggestion of using socat as a proxy for all of my docker CLI commands using the following commands:
# on one terminal
sudo socat -t100 -v UNIX-LISTEN:/tmp/proxysocket.sock,mode=777,reuseaddr,fork UNIX-CONNECT:/var/run/docker.sock
# on a second terminal
export DOCKER_HOST="unix:///tmp/proxysocket.sock"
Subsequent `docker` cli commands will be proxied through socat and their CLI calls will be displayed on the other terminal
Problem
I'm trying to link a child mongo container to a parent node container using the Docker remote API v1.7. I see the `Links` property in HostConfig which I'm guessing is passed to the `POST /containers/<id>/start` request like ``` { "Links": ["<container-name>:<alias>", ...] } ``` I don't see how to name the mongo container to use when starting the node container. Is there an API analogy to the CLI `-name` flag for `docker run`? Do I need to make a separate `GET /containers/<id>/json` request and live with the auto-generated name?