Hi all,
I try to build docker-compose file that will create DB, Ghost and phpmyadmin containers and they need to be on separate networks. I define network as normal, but when i run compose file all containers goes to the same network “backend_ghost”. I try with frontend_ghost:8080:80 and frontend_ghost:8081:2368 , but I get “error no Ip address”. Is there way to define on witch network container to expose port?
version: '3.1'
services:
db:
image: mariadb:10.6
restart: always
volumes:
- /volume1/mysql:/etc/mysql/conf.d
networks:
- backend_ghost
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: ghost
MYSQL_USER: ghost
MYSQL_PASSWORD: ghost
phpmyadmin:
depends_on:
- db
image: phpmyadmin
restart: always
ports:
- 8081:80
networks:
- frontend_ghost
- backend_ghost
environment:
PMA_HOST: db
MYSQL_ROOT_PASSWORD: rootpassword
ghost:
image: ghost:5-alpine
restart: always
volumes:
- /volume1/data:/var/lib/ghost/content
ports:
- 8080:2368
networks:
- frontend_ghost
- backend_ghost
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: ghost
database__connection__password: ghost
database__connection__database: ghost
# this url value is just an example, and is likely wrong for your environment!
url: https://example.com
networks:
frontend_ghost:
backend_ghost:
Thanks in advice!