I am new to using PHPMyAdmin in docker, and so I was able to get the containers for MySQL and for PHPMyAdmin running, but after restarting my computer, both containers exited.
I tried running docker-compose up -d
again in the directory containing my dockerfile but I get these errors:
Error starting userland proxy: listen tcp 0.0.0.0:3306: bind: address already in use
Error starting userland proxy: listen tcp 0.0.0.0:8080: bind: address already in use
Following this, I tried running docker-compose down which removes the two containers, but docker-compose up is still not able to restart the two containers due to these errors.
I also tried calling sudo kill -9 PID
on the MySQL process running on port 3306 but each time I call it, there remains a process running on that port.
The third thing I tried is docker-compose rm and removing these containers before running docker-compose up -d again, as well as docker-compose restart, but I still run into this error.
Is there a proper way of restarting the containers I am using? Or am I misunderstanding the standard for running docker containers?
EDIT: This is my docker-compose.yaml:
version: "3.7"
services:
mysql-server:
image: mysql:8.0.19
restart: always
environment:
MYSQL_ROOT_PASSWORD: secret
volumes:
- mysql-data:/var/lib/mysql
ports:
- "3306:3306"
phpmyadmin:
image: phpmyadmin/phpmyadmin:5.0.1
restart: always
environment:
PMA_HOST: mysql-server
PMA_USER: root
PMA_PASSWORD: secret
ports:
- "8080:80"
volumes:
mysql-data: