Accessing (wget/ping) localhost inside wordpress container

Hi,

I’m using https://hub.docker.com/_/wordpress/, docker compose and the Gravity Forms plugin and the webhooks plugin.

I’m able to access the site via a browser on my host machine on localhost:8001 no problem.

But i’m unable to wget localhost:8001 from within the container. (This is basically needed so that when the user fills in a form a webhook results in a request to an Admin AJAX URL on localhost:8001)

Is there anything I can add to my docker-compose to make it so that my container can access localhost? I have tried network_mode=host but the site can’t be reached

I get this error in my logs

2018-10-04 14:07:45.952316 - DEBUG --> GF_Background_Process::dispatch(): Unable to dispatch tasks to Admin Ajax: cURL error 7: Failed to connect to localhost port 8001: Connection refused 

This is my docker-compose.yml file

version: '3.3'


services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: x
       MYSQL_DATABASE: x
       MYSQL_USER: x
       MYSQL_PASSWORD: x

   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8001:80"
     restart: always
     volumes:
     - ./wordpress:/var/www/html
     - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: x
       WORDPRESS_DB_PASSWORD: x
volumes:
    db_data:

Hi,

Did you solved your problem ?

I’m in the same configuration : docker + wordpress + GF + Webhook…

But apparently, neither Slack extension is working because of the same problem!

Thanks,