Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup/Add MySQL/phpMyAdmin Docker Compose #4

Merged
merged 2 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ List of Docker Compose setups.

- [`PostgreSQL / pgAdmin`](https://github.com/bhavik2936/docker-compose-files/blob/main/postgres-pgadmin) - Basic setup of PostgreSQL database with pgAdmin.

- [`MySQL / phpMyAdmin`](https://github.com/bhavik2936/docker-compose-files/blob/main/mysql-phpmyadmin) - Basic setup of MySQL database with phpMyAdmin.

## Feedback
Suggestions/improvements are [welcomed](https://github.com/bhavik2936/docker-compose-files/issues)!
27 changes: 27 additions & 0 deletions mysql-phpmyadmin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# MySQL-phpMyAdmin Docker Compose
It contains docker instances for both **MySQL** & **phpMyAdmin** internally connected via bridge network.

### MySQL
MySQL, the database server itself can be accessed on host machine (localhost) on port _3306_.

#### Description
Below configuration are already set by default via `mysqlCreds.env` file and can be modified by overriding the same.

| Config | Value | Comment |
| -------- | ----- | -------------------------------- |
| Port | 3306 | Exposed at localhost (127.0.0.1) |
| Username | root | |
| Password | root | |

### phpMyAdmin
phpMyAdmin is integrated to graphically visualize the mysql database.
It can be accessed on host machine (localhost) web browser at http://localhost:8080.

#### Configuration
Below configuration are already set by default via `phpmyadminCreds.env` file and can be modified by overriding the same.

| Config | Value | Comment |
| -------- | ----- | -------------------------------- |
| Port | 8080 | Exposed at localhost (127.0.0.1) |
| Username | root | |
| Password | root | |
41 changes: 41 additions & 0 deletions mysql-phpmyadmin/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Version of docker-compose file is no longer required
version: '3.3'

services:

mysql:
image: mysql
container_name: mysql
restart: unless-stopped
ports:
- 3306:3306
env_file:
- mysqlCreds.env
networks:
- mysql-network
volumes:
- mysql-data:/var/lib/mysql

phpmyadmin:
image: phpmyadmin
container_name: phpmyadmin
restart: unless-stopped
depends_on:
- mysql
ports:
- 8080:80
env_file:
- phpmyadminCreds.env
networks:
- mysql-network

# Bridge type of network connecting to both (mysql, phpmyadmin) containers.
# As recommended by docker (https://docs.docker.com/network/bridge)
networks:
mysql-network:
name: mysql-network
driver: bridge

# Named volumes for persisting necessary containers' data across restart.
volumes:
mysql-data:
1 change: 1 addition & 0 deletions mysql-phpmyadmin/mysqlCreds.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MYSQL_ROOT_PASSWORD=root
1 change: 1 addition & 0 deletions mysql-phpmyadmin/phpmyadminCreds.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PMA_HOST=mysql