L
L
lex2020-04-19 16:03:04
Docker
lex, 2020-04-19 16:03:04

How to make one network for two docker containers?

Good evening!

version: '3'

services:
    server:
        build: 
            context: ./build-server/
        environment: 
            - TOKEN:${TOKEN}
    agent:
        depends_on:
            - server
        build: 
            context: ./build-agent/


there is such a config, the context folders have their own docker files, how can I assemble containers on the same network, so that they can be accessed from one to another localhost: 3000 well, the port is optional?

These are two services = two containers that communicate with each other constantly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2020-04-19
bem @bemdev

In the section of the container that should have access to localhost, add the entry: network_mode: host

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question