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

  • Tomcat not running on docker image
  • docker swarm service how to specify a delay time in restart policy?
  • Jelastic run.log not working on docker
  • TLS failed in Docker
  • How to pass a parameter to docker with kubernetes
  • Docker Windows send build context fails if over 80Mb
  •   input:
      build: InputBuffer
        - queue
        - output
        - "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.

  • smtp sendmail in Dockerised Golang Web App in GAE doesn't work
  • How to run docker containers on different machines
  • DNS issue with docker image
  • Start Docker container using systemd socket activation?
  • docker-compose scale service with independent volumes
  • Can't reach Asp.Net Core inside Docker
  • 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.