I have an issues I discovered while trying to try PHPUnit tests with CURL commands. I always get:
Connecting to www.example.local (www.example.local)|127.0.0.1|:80... failed: Connection refused.
I then tried to run wget and curl commands from the container command line, same problem. I have docker working like this.
In my computer’s /etc/hosts
127.0.0.1 www.example.local
127.0.0.1 api.example.local
and so forth and it works when accessing the sites in my browser. In my docker-compse.yml, I have:
version: “3.4”
volumes:
postgres_database :
external: false
mysql_data : {}
schemas:
external: false
services:
php:
build:
context : ./
dockerfile : Dockerfile
network: host
volumes:
- ./:/code
- ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
depends_on: [ "postgres"]
ports:
- "9000:9000"
expose:
- "9000"
container_name: binge_php
web:
image: nginx:latest
build:
context : ./
dockerfile : Dockerfile_Nginx
network: host
ports:
- "80:80"
expose:
- "0"
volumes:
- ./:/code
- ./site.conf:/etc/nginx/conf.d/site.conf
- ./nginx_custom_settings.conf:/etc/nginx/conf.d/nginx_custom_settings.conf
links:
- php
depends_on:
- php
container_name: binge_nginx
What might I be doing wrong that is preventing me from running curl commands from inside the php container?