A
A
Alexey Nikolaev2019-08-20 09:04:23
Docker
Alexey Nikolaev, 2019-08-20 09:04:23

Why does Docker open port 80 where it shouldn't?

Good morning.
Actually, there is a project with two microservices: site and users. I need the site to be accessible on port 80, and for users all external ports would be closed. For this I use the following configuration:

Dockerfile\site
FROM php:7.2.19-apache

# тут просто устанавливаю все, НИКАКИХ директив, только RUN

EXPOSE 80
dockerfile\users
FROM php:7.2.19-apache

# тут просто устанавливаю все, НИКАКИХ директив, только RUN
docker-compose.yml
version: '3'
services: 
  site:
    build: './site'
    ports: 
      - 80:80
    links:
      - "users"
  users:
    build: './users'
    expose:
      - 8000

However, the problem is that when I run `docker-compose up --build' it throws the error "Error starting userland proxy: listen tcp 0.0.0.0:80: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted". At the same time, `docker ps` shows that the service `users` (!!!) is running and listening on port 80, but why? This port is clearly mapped on the site service!
Where did I go wrong? make Docker:
- bind port 80 from my machine to the container port (80:80)
- leave users alone so that this service can only be accessed from inside the site container on port 8000

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SergioMaroni, 2019-08-20
@SergioMaroni

No one is already sitting on port 80 on your host machine?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question