rwxr-xr-x 1 root root 1073 Oct 19 05:37 healthcheck.sh rw-r-r- 1 root root 86 Jan 12 03:41 healthcheck.cnf Lrwxrwxrwx 1 root root 7 Oct 12 22:06 bin -> usr/binĭrwxr-xr-x 5 root root 340 Jan 12 03:41 devĭrwxr-xr-x 2 root root 4096 Oct 19 05:47 docker-entrypoint-initdb.d The official image can connect to any MySQL server that’s accessible from your host, including databases running in other Docker containers.Drwxr-xr-x 1 root root 4096 Jan 12 03:41. Installing PHPMyAdmin in Docker gives you an isolated environment that can be created, replaced, and deleted using a handful of Docker CLI commands. Bare-metal installation adds several dependencies to your system, bundling Apache and PHP alongside the app’s source code. PHPMyAdmin is one of the most popular and best known MySQL administration utilities. docker run -d -name phpmyadmin -e PMA_HOST_FILE=/run/secrets/pma_host -p 8080:80 phpmyadmin Summary Append _FILE to the variable’s name, then set the value to a path inside the container that provides the actual value. Sensitive values, such as PMA_HOST, PMA_PASSWORD, and MYSQL_ROOT_PASSWORD, can be injected using Docker secrets instead of plain environment variables. These include MEMORY_LIMIT, UPLOAD_LIMIT and MAX_EXECUTION_TIME, each of which correspond to PHP INI values that might need to be adjusted if you’re using long-running or complicated queries.
The image also supports environment variables for many common settings. You can add any of the configuration variables supported by PHPMyAdmin. The path is /etc/phpmyadmin/: docker run -d THe PHPMyAdmin Docker image supports a user-supplied configuration file that you can inject via a Docker volume. Docker Compose automatically sets hostnames to match service names, allowing PHPMyAdmin to connect to MySQL using the shared network. PHPMyAdmin’s PMA_HOST variable is set to mysql, referencing the MySQL service name. Run docker-compose up -d to bring up MySQL with a fully networked PHPMyAdmin container. Here’s a docker-compose.yml for PHPMyAdmin in arbitrary connection mode: You can bring up a new PHPMyAdmin container in a repeatable fashion using the docker-compose up -d command. Writing a Docker Compose file simplifies non-trivial deployments. Simplifying Deployment With Docker Compose Set the PMA_HOST environment variable to 172.17.0.1 when you start the container. Now PHPMyAdmin will be able to reach the MySQL container via the shared network. This functionality is deprecated in Docker though so switching to the network commands is preferable: docker network create phpmyadminĭocker network connect phpmyadmin mysql_container_name -ip 172.17.0.1ĭocker network connect phpmyadmin phpmyadmin_container_nameĪs an alternative, you can start PHPMyAdmin with a preconfigured network connection using Docker’s -network flag: docker run -d -name phpmyadmin -network phpmyadmin -p 8080:80 phpmyadmin This command lets you connect PHPMyAdmin to the my_mysql_container container without manually setting up networking links. Supply the PMA_HOST and PMA_PORT environment variables instead of PMA_ARBITRARY: docker run -d -name phpmyadmin -e PMA_HOST= -e PMA_PORT=33060 -p 8080:80 phpmyadmin Presetting a ServerĪs an alternative to allowing arbitrary access, you can start the PHPMyAdmin container with a preconfigured server connection. Your user account will need permission to create new databases on the server. PHPMyAdmin uses this schema to store its own configuration data.įollow the warning’s link to “Create a database” to complete the installation. When you’re using this method, you’ll normally see a PHPMyAdmin warning that “some extended features have been deactivated.” This occurs when the server you’re connected to has no database called phpmyadmin. Specify the host and user credentials of your MySQL or MariaDB database to login. The presence of the PMA_ARBITRARY environment variable results in a server connection form being displayed. Visit localhost:8080 in your browser to see the login screen. This command starts PHPMyAdmin on port 8080.