I am correctly trying to pass a container ip address to another
Here is my docker-compose.yml file
app-phpmyadmin:
image: phpmyadmin/phpmyadmin
depends_on:
- app-mysql
ports:
- '80'
container_name: app-phpmyadmin
environment:
PMA_HOST: app-mysql
PMA_PORT: 3306
app-mysql:
image: mysql:8
container_name: app-mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: app-phpmyadmin <<<< doesnt work see below why
ports:
- 3306
When passing app-phpmyadmin instead of passing the ip it actually writes “app-phpmyadmin” as a string. On selecting use, host from mysql.user the hostname is “app-phpmyadmin” instead of the ip.
Is there a way I can do this in the docker-compose file or would i have to come up with a bash script that does it?
2
Answers
try this
Actually, you can have try to use static network address