Docker Community Forums

Share and learn in the Docker community.

Docker-compose IP/Ports binding


(Ttermeer) #1

Expected behavior

Exposed ports should be binded to 0.0.0.0 so that linked container can access them

Expected docker ps
b0c2fb4cf1c0 dockersymfony_adj_php “/docker-entrypoint.s” 11 days ago Up 3 days 0.0.0.0:9000->9000/tcp dockersymfony_adj_php_1

Actual behavior

Ports are binded to 10.0.75.2 but that IP is not transmitted to linked containers

Docker PS on windows docker :
041dd5b8197f dockersymfony_adj_php “/docker-entrypoint.s” 2 hours ago Up 16 minutes 10.0.75.2:9000->9000/tcp dockersymfony_adj_php_1

printenv on a container that is linked with previous container shows the usual 172.17.0.5 IP :
ADJ_PHP_PORT=tcp://172.17.0.5:9000

Information

relevant part of docker-compose file :
adj_php:
build: php-fpm
ports:
- 9000:9000
volumes_from:
- adj_application
links:
- adj_db
restart: always
adj_nginx:
build: nginx
ports:
- 82:80
- 445:443
links:
- adj_php
volumes_from:
- adj_application
volumes:
- ./logs/nginx/:/var/log/nginx

Steps to reproduce the behavior

  1. Link nginx with php-fpm in a docker-compose
  2. start the containers with docker-compose up-d

(Michael Friis) #2

The container web process will be available on the docker hostname. This is covered here: https://beta.docker.com/docs/windows/getting-started/#step-4-explore-the-application-and-run-examples


(Ttermeer) #3

I am not looking for external access but cross container connection. This is a behavior that works on docker linux ( and even the old Docker Toolbox )