title: How to connect to an existing docker network with docker remote API (through dockerode)
body: <p>I use <code>docker-compose</code> to create a "park" of container inter-linked. Nothing special here, I have API/Frontend/Backend etc.. There is my <code>docker-compose.yml</code> :</p>
  
  <pre><code>version: "2"
  
  services:
      api:
          build: ./deimos_api/docker
          ports:
              - "39999:80"
          volumes:
              - ./deimos_api:/root/deimos_api
      asset:
          build: ./deimos_asset/docker
          ports:
              - "8000:80"
          volumes:
              - ./deimos_asset:/root/deimos_asset
          depends_on:
              - api
          links:
              - api
      data-manager:
          build: ./deimos_data_manager/docker
          ports:
              - "3333:3333"
          volumes:
              - ./deimos_data_manager:/root/deimos_data_manager
          depends_on:
              - api
          links:
              - api
      backend:
          build: ./deimos_backend/docker
          ports:
              - "1080:80"
          volumes:
              - ./deimos_backend:/root/deimos_backend
              - /var/run/docker.sock:/var/run/docker.sock
          depends_on:
              - api
              - asset
          links:
              - api
  </code></pre>
  
  <p>I just learn that create a "park" like this linked container on a new network. <code>docker network ls</code> result :</p>
  
  <pre><code>NETWORK ID          NAME                DRIVER
  448daa341d56        bridge              bridge              
  c7feeeb44cd0        deimos_default      bridge              
  1fc2d6132b86        none                null                
  a80e41eab3cc        host                host   
  </code></pre>
  
  <p>An other part of the project is to generated on the fly container. But I want that new container access to the <code>deimos_api</code> container previously created by <code>docker-compose</code>.</p>
  
  <p>I'm using <code>dockerode</code> (wrapper of Docker Remote API) in javascript with the following code :</p>
  
  <pre><code>docker.createContainer({
      "Image": config.dockerGameServerImageName,
      "name": config.gameServerPrefix + serverName,
      "Volumes": {"/root/deimos_server":{}}
  }, function (err, container) {
      if(err){
          console.log(err);
          reject(err);
      } else {
          container.start({
              "PortBindings": { "80/tcp": [{"HostPort": lastPortUsed+""}]},
              "Binds":[config.deimosServerVolumePath+":/root/deimos_server"],
              "Links":[config.dockerApiContainerName+":api"]
          }, function (err, data) {if(err) {
                  console.log(err);
                  reject(err);
              } else {
                  console.log("Create container " + serverName);
                  gameContainer[config.gameServerPrefix + serverName] = lastPortUsed+"";
                  resolv({
                      'serverPort':lastPortUsed,
                      'serverName':serverName
                  });
              }
          });
      }
  });
  </code></pre>
  
  <p>But I have the following error :</p>
  
  <pre><code>Error: HTTP code is 500 which indicates error: server error - Could not get container for deimos_api_1
  </code></pre>
  
  <p>Any idea how to specify in dockerode how to join a specific network (here deimos_default) ?</p>
  
  <p>Thank You.</p>
  
  <p>EDIT : I'm using docker 1.10.3, docker-compose 1.6.2 and dockerode 2.2.10</p>