Hello im trying to connect mysql to my phpmyadmin container how can i bind the mysql to this. is it also possible to change the port 8080 to /phpmyadmin im access to http://192.168.99.100:8080 so i get http://192.168.99.100/phpmyadmin instead of the container id
version: '2'
services:
#######################################
# PHP application Docker container
#######################################
app:
build:
context: .
dockerfile: Dockerfile
links:
- mysql
ports:
- "8000:80"
volumes:
- ./app/:/app/
- ./:/docker/
volumes_from:
- storage
networks:
- php-network
#######################################
# MySQL server
#######################################
mysql:
build:
context: docker/mysql/
dockerfile: MySQL-5.7.Dockerfile
restart: always
volumes_from:
- storage
env_file:
- etc/environment.yml
networks:
- php-network
#######################################
# PHP MY ADMIN
#######################################
myphpadmin:
build:
context: docker/myphpadmin
dockerfile: Dockerfile
restart: always
links:
- mysql
ports:
- 8080:80
environment:
- PMA_ARBITRARY=1
networks:
- php-network
storage:
build:
context: docker/storage/
volumes:
- /storage
networks:
php-network:
driver: bridge
You will have to specify 2 more variables inside your docker-compose file under the phpmyadmin service:
environment:
PMA_HOST: mysql
PMA_PORT: 3306
Because even though you have created the link between your phpmyadmin and mysql containers, the phpmyadmin container will look for a database on 'localhost'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With