How to install and use PhpMyAdmin with Docker

This is most commonly used tool to visual inspect mysql databases with drupal, so there is a good chance you will want to use it with docker. So if you don't have it already installed with your drupal compose and you are building it from scratch you can manually add it. Do:

docker pull phpmyadmin/phpmyadmin

and then after image is pulled you need to link it to your current DB container, if it is not already made, you should make one.

docker run --name myadmin -d --link my_drupal82_project_mariadb:db -p 8020:80 phpmyadmin/phpmyadmin

myadmin is name of your new conatiner
my_drupal82_project_mariadb is name of your DB container
and port is set to 8020

so you will be able to access your new installation of PMA on http://localhost:8020/ or so, depending on your project base URL.

If you get an error message like

 Error response from daemon: Cannot link to /my_drupal82_project_mariadb, as it does not belong to the default network.

this means that new container is on different network, you can check current ones with "docker network ls" command. With that info you can run command again to put this new container to the same network, so you input this:
 

docker run --name myadmin -d --link my_drupal82_project_mariadb:db -p 8020:80 --net dd88_default phpmyadmin/phpmyadmin

where we have this flag "--net dd88_default "  to set this container to run also on the same network as our linked DB container
more on this here....
https://docs.docker.com/engine/reference/run/#network-settings