<p>I would like to use my docker-compose config for development purposes and run frontend, backend, nginx for routing services to run and start together. For now I'm using also kubernetes port-forwarding in order to get to my neo4j db. What I want to achieve is to use mapped port inside docker containers, ie. external port should be also visible inside the docker. It runs without docker smoothly but cannot inside containers. My docker-compose file looks like this, nothing fancy:</p>

<pre><code>version: '3'

networks:
  lan:

services:
  nginx:
    restart: always
    build:
      dockerfile: Dockerfile.dev
      context: ./nginx
    ports:
      - 3050:80
    depends_on:
      - client
      - api

  client:
    build:
      context: ./client
      dockerfile: Dockerfile.dev
    volumes:
      - /app/node_modules
      - ./client:/app

  api:
    build:
      context: ./
      dockerfile: Dockerfile.dev
    volumes:
      - /app/node_modules
      - ./:/app
    environment:
      - REACT_APP_NEO4J_HOST=neo4j://neo4j:password@localhost:7687
      - REACT_APP_NEO4J_LOGIN=neo4j
      - REACT_APP_NEO4J_PASS=password
</code></pre>

<p>Unfortunately I'm getting error as it is not forwarder inside my docker api container. To forward the port I'm using (after getting authenticated): 
<code>kubectl port-forward svc/neo4j-ee-neo4j 7687:7687</code> but of course it is only available on my host. </p>

Murakami
<p>add <code>network_mode: "host"</code> to the service properties, so it will share the host interface.
<a href="https://docs.docker.com/compose/compose-file/#network_mode" rel="nofollow noreferrer">https://docs.docker.com/compose/compose-file/#network_mode</a></p>
