aliases for external containers linked through network

Viewed 4804

Lets say we have two web services: alpha & beta

1) docker-compose.yml for alpha:

version: '2'

services:
    web:
        build: .
        env_file: local.env
        networks:
          - default
          - beta

    networks:
        beta:
            external:
                name: beta_default

2) docker-compose.yml for beta:

version: '2'

services:
    web:
        build: .
        env_file: .env
        expose:
          - "5000"

That way I can interact (e.g ping) beta_web_1 container from alpha_web_1 container. What I want is to make an alias for beta_web_1 container, so that I could name it after a valid URL, e.g: beta.local.

I would like this to happen inside docker-compose.yml for alpha or in any way that keeps it inside alpha's scope of view, so that I wouldn't need to change the actual system-wide name for beta_web_1

Is this possible?

1 Answers
Related