You are not logged in.

#1 2018-11-22 18:10:52

x-yuri
Member
Registered: 2013-01-06
Posts: 116

Publishing ports doesn't work with docker compose

Hi,

I'm trying to achieve this:

# docker run --rm -itp 4000:80 nginx
# curl localhost:4000
<outputs welcome page>

with docker compose.

docker-compose.yml:

services:
  nginx:
    image: nginx:stable
    ports:
      - "4001:80"
# docker stack deploy -c docker-compose.yml s1
# curl localhost:4001
<hangs>

On Ubuntu 18.04 it seems to work. But I can't see docker-18.09.0 there, so it must have been installed from some PPA.

I can access nginx via docker0 and docker_gwbridge NICs though. One guess is that Ubuntu takes extra steps for it to work with localhost. Or fixes some bug. Do you have any suggestions on how to make it work with localhost?

Thanks in advance.

Offline

Board footer

Powered by FluxBB