This repository provides a simple solution for deploying phpMyAdmin using Docker. It includes scripts and configuration files to automate the setup process for accessing phpMyAdmin in a Dockerized environment connected to an existing MySQL database.
- Quick Setup: Deploy phpMyAdmin quickly with minimal configuration.
- Customizable Ports: Access phpMyAdmin via a user-defined port.
- Network Integration: Connect phpMyAdmin to your existing Docker network for seamless integration with MySQL.
- Environment File Support: Configure phpMyAdmin parameters via a
.envfile.
- Docker must be installed and running on your system.
- Docker Compose must be installed.
- Git must be installed and available in your system's PATH.
sudo apt install git # For Debian/Ubuntu sudo yum install git # For CentOS/RHEL brew install git # For macOS
- Linux Only: Ensure
dos2unixis installed to handle line ending conversions if needed.sudo apt install dos2unix
Open PowerShell as Administrator and run:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass; git clone https://github.com/amir377/docker-phpmyadmin-setup; cd docker-phpmyadmin-setup; ./install.ps1Run the following command in your terminal:
git clone https://github.com/amir377/docker-phpmyadmin-setup && cd docker-phpmyadmin-setup && dos2unix install.sh && chmod +x install.sh && ./install.sh-
Clone the repository:
git clone https://github.com/amir377/docker-phpmyadmin-setup.git cd docker-phpmyadmin-setup -
Place your
docker-compose.example.yamlfile in the root directory (if not already provided). -
Run the appropriate installation script:
- For Windows:
install.ps1 - For Linux/Mac:
install.sh
- For Windows:
-
Follow the prompts to customize your setup:
- Container name
- Network name
- phpMyAdmin port
- MySQL service name
Automates the setup process for Windows, including:
- Generating
.envanddocker-compose.yamlfiles. - Ensuring Docker and Docker Compose are installed.
- Creating the specified Docker network.
- Building and starting the phpMyAdmin container.
Automates the setup process for Linux/Mac, including:
- Generating
.envanddocker-compose.yamlfiles. - Ensuring Docker and Docker Compose are installed.
- Creating the specified Docker network.
- Building and starting the phpMyAdmin container.
Holds configuration values for the phpMyAdmin container. Example:
# PMA container settings
CONTAINER_NAME=phpmyadmin
PMA_PORT=8080
NETWORK_NAME=general
ALLOW_HOST=0.0.0.0A template file for the docker-compose.yaml file. Placeholders are dynamically replaced with values from the .env file. Example:
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin
container_name: ${CONTAINER_NAME}
environment:
PMA_ARBITRARY: 1
ports:
- "${ALLOW_HOST}:${PMA_PORT}:8080"
networks:
- ${NETWORK_NAME}
networks:
${NETWORK_NAME}:
external: trueGenerated file used to deploy the phpMyAdmin container with Docker Compose.
- Access phpMyAdmin in your browser at
http://127.0.0.1:<PMA_PORT>. - Log in using your MySQL credentials.
If the container fails to start, the script will display logs automatically:
docker logs <container-name>If you need to access the phpMyAdmin container shell:
docker exec -it <container-name> bash- Ensure Docker is running before executing the script.
- If you encounter permission issues, run PowerShell or Bash as Administrator.
- Update the
docker-compose.example.yamlfile to suit your specific requirements.
This project is licensed under the MIT License. See the LICENSE file for details.
Feel free to customize the script or template files to fit your specific use case!