How to link two docker containers which are spawned with two different docker-compose.yml

I have two containers. Each one is spawned in two different docker-compose. How can I link between these containers.

Example: in a single docker-compose

  • Docker linking db container with spring boot and get environment variables
  • docker: installing a node.js application has issues, since docker runs as root
  • Slow meteor build performance in docker container
  • Access jboss 8080 port inside docker container
  • Running docker with pgadmin on mac getting Error: Unable to initialize GTK+, is DISPLAY set properly?
  • Docker failover: Redis, MySQL and Nginx
  •   input:
      build: InputBuffer
      links:    
        - queue
        - output
      ports:
        - "30005:30005/udp"
    

    But in the links part, I want to link to another container which is spawned by another docker-compose.yml in the same host.

  • Unable to connect to Docker in Docker
  • Error while run Sphinx search service
  • Docker volume container store in different drives
  • How do I install Docker on an NVIDIA Tegra Jetson TK1 with a 32 bit ARM processor running Ubuntu 14.04?
  • Dockerfile CMD `command not found`
  • Files not getting added in docker workspace
  • One Solution collect form web for “How to link two docker containers which are spawned with two different docker-compose.yml”

    You should use external_links. From the docs:

    Link to containers started outside this docker-compose.yml or even
    outside of Compose, especially for containers that provide shared or
    common services.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.