I
I
Igor2019-09-08 12:06:41
Docker
Igor, 2019-09-08 12:06:41

docker-compose how to link to real host?

Colleagues, good afternoon.
Perhaps the question will seem stupid.
I have recently been working with docker.
docker-compose.yml

spoiler

version: "3.1"

services:

  # Php application
  app:
    container_name: gorodbrand.app
    restart: on-failure
    build: .
    volumes:
      - .:/var/www
      - ./docker/php/log:/var/log
    depends_on:
      - db


  # Database
  db:
    image: percona
    container_name: gorodbrand.db
    restart: always
    volumes:
      #- ./docker/mysql/.db:/var/lib/mysql
      - ./docker/mysql/log:/var/log/mysql
      - ./docker/mysql/conf.d:/etc/mysql/conf.d
    environment:
      - MYSQL_ROOT_PASSWORD=root
      - MYSQL_DATABASE=catalog
      - MYSQL_USER=1234
      - MYSQL_PASSWORD=1234
    ports:
      - "3340:3306"


  # Nginx server api
  nginx-api:
    image: nginx:latest
    container_name: gorodbrand.nginx-api
    #restart: on-failure
    build: ./docker/nginx
    volumes:
      - ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
      - ./docker/nginx/sites-enabled/vhost-api.gorodbrand.conf:/etc/nginx/sites-enabled/vhost-api.gorodbrand.conf
      - ./docker/nginx/logs:/var/log/nginx
    ports:
      - "8080:80"
    depends_on:
      - app


Deployed the application to docker.
Everything is set up as needed.
The application is available at 10.0.75.1
And then how?
I have a real server with an ip address.
Do I really need to configure nginx in proxy mode in order for the application from the docker to be accessible via the Internet?
Show on your fingers.
1. Real server.
2. Docker is an isolated environment.
How to set up this connection now?
In all examples, everything ended with hello world on the local server.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dimagusarov1, 2019-09-08
@dimagusarov1

ip:8080
you have container port 80 mapped to host port 8080 in nginx-api

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question