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

  • How to run docker image , take ssh of container and bind port to “49” in single cmd?
  • What is the proper way to Clean up custom namespace content after container is deleted
  • Docker losing volume bind mount
  • How to escape CMD in Dockerfile
  • Eureka cluster and docker-compose: Registering with host even when I set preferIpAdress: true
  • Save tables in Docker container
  •   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.

  • Custom Installer for Unix Platform to install Python, Java, MySQL
  • Logging from one docker container to another
  • Neo4j in Docker - Max Heap Size Causes Hard crash 137
  • Docker : How to avoid Operation not permitted in Docker Container?
  • context or workdir for docker-compose
  • How to understand docker container disk space usage?
  • 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.