Skip to content

Instantly share code, notes, and snippets.

@vmari
Created June 5, 2018 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vmari/7ed843064d2184c25521b5a65231c2f6 to your computer and use it in GitHub Desktop.
Save vmari/7ed843064d2184c25521b5a65231c2f6 to your computer and use it in GitHub Desktop.
Run phpmyadmin with docker through UNIX sockets on localhost
# Run phpmyadmin with docker on your localhost (minimal configuration)
docker run -d -p 8080:80 \
--name phpmyadmin \
-e "PMA_HOST=localhost" \
-v /var/run/mysqld/mysqld.sock:/tmp/mysql.sock \
phpmyadmin/phpmyadmin
# if you want autologin replace PMA_USER and PMA_PASSWORD
# warning: you're opening the database to the world if you're not behind a firewall
docker run -d -p 8080:80 \
--name phpmyadmin \
-e "PMA_HOST=localhost" \
-e "PMA_USER=root" \
-e "PMA_PASSWORD=1234" \
-v /var/run/mysqld/mysqld.sock:/tmp/mysql.sock \
phpmyadmin/phpmyadmin
# Once created you can stop, run and remove the container as you want, it's yours.
docker stop phpmyadmin
docker start phpmyadmin
docker rm phpmyadmin
@joanfabregat
Copy link

It seems that there is a non documented PMA_SOCKET env var that you can use instead of PMA_HOST to specify the path to the socket.

You could run something like:

docker run -d -p 8080:80 \
           --name phpmyadmin \
           -e "PMA_SOCKET=/tmp/mysql.sock" \
           -v /var/run/mysqld/mysqld.sock:/tmp/mysql.sock \
           phpmyadmin/phpmyadmin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment