I have a wordpress app in a container that needs to access a localhost webapp setup with self signed cert. I've tried using extra_hosts (both with 127.0.0.1 & 10.0.2.2) in my docker compose file without much success. Any help with this is greatly appreciated.
version: '3.3'
services:
wordpress:
image: mywordpress:latest
container_name: mywordpress
networks:
- db-net
links:
- mysql
ports:
- "8088:80"
restart: always
volumes:
- wp_data:/var/www/html
depends_on:
- mysql
extra_hosts:
localhost: 10.0.2.2
environment:
WORDPRESS_DB_HOST: mysql:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
mysql:
image: mysql:latest
container_name: mysql
volumes:
- db_data:/var/lib/mysql
restart: always
networks:
- db-net
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
networks:
db-net:
driver: bridge
volumes:
db_data:
wp_data:
EDIT The wordpress application in the container needs to access an API hosted locally on the actual host machine (this is the app with the self signed cert)