Docker Community Forums

Share and learn in the Docker community.

/etc/hosts entry linked to another container IP

docker

(Kelemen) #1

Hi,
i have 2 container, 1 for nginx and 1 for php-fpm. On host machine i have web application files. I have created some vhosts on nginx container (eg. a.localhost.sk, b.localhost.sk, …).

When i try to call curl (from my web application) to any vhost i got error (unresolved host). I need add new lines to /etc/hosts on my php container linked to nginx container IP.

NGINX_CONTAINER_IP a.localhost.sk
NGINX_CONTAINER_IP b.localhost.sk

It is possible to configure something like this in docker-compose file?