How to install PhpMyAdmin by using Docker Compose on Ubuntu 21.04
To Install PhpMyAdmin by using Docker Compose on Ubuntu 21.04
Introduction:
Docker is a software platform that enables rapid development, testing, and deployment of applications. phpMyAdmin is a free software tool written in PHP that allows users to manage MySQL over the Web, as well as perform a wide range of operations on MySQL and MariaDB.
Installation Procedure:
Step 1: Check the OS version by using below command
root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 21.04
Release: 21.04
Codename: hirsute
Step 2: Create a Mariadb Docker Image from official Docker Hub by using the below command
root@linuxhelp:~# docker create mariadb:latest
Unable to find image 'mariadb:latest' locally
latest: Pulling from library/mariadb
ea362f368469: Pull complete
adb9a1b1379d: Pull complete
ac5c95406850: Pull complete
fa48d8b47ec1: Pull complete
bcf1feb44ac3: Pull complete
8a5de7784a0f: Pull complete
b8724b8a281a: Pull complete
a8a7c3f612d6: Pull complete
39b09b59e889: Pull complete
14bc3a6b0a94: Pull complete
Digest: sha256:5a37e65a6414d78f60d523c4ddcf93d715854337beb46f8beeb1a23d83262184
Status: Downloaded newer image for mariadb:latest
3525eab40ea2e1ee53391473937df0b0983ed1290b5ecf89d9e55eb8a10a2894
Step 3: Run the Mariadb container with defining Environment variables by using the below command
root@linuxhelp:~# docker run --name mariadb -e MARIADB_ROOT_PASSWORD=linuxc -d mariadb:latest --port 3808
99729803a499aaffbc8c3a0489d99144727ddf87c480642e7c80fc578f698848
Step 4: View the Running Containers by using the below command
root@linuxhelp:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
99729803a499 mariadb:latest "docker-entrypoint.s…" 7 seconds ago Up 6 seconds 3306/tcp mariadb
Step 5: Create a docker-compose.yml file
root@linuxhelp:~# vim docker-compose.yml
version: '3.1'
services:
db:
image: mariadb:latest
restart: always
environment:
MYSQL_ROOT_PASSWORD: linuxc
phpmyadmin:
image: phpmyadmin
restart: always
ports:
- 8080:80
environment:
- PMA_ARBITRARY=1
Step 6: Execute the Docker Compose file by using below command
root@linuxhelp:~# docker-compose up
Creating network "root_default" with the default driver
Pulling phpmyadmin (phpmyadmin:)...
latest: Pulling from library/phpmyadmin
a2abf6c4d29d: Pull complete
c5608244554d: Pull complete
2d07066487a0: Pull complete
1b6dfaf1958c: Pull complete
32c5e6a60073: Pull complete
90cf855b27cc: Pull complete
8b0f1068c586: Pull complete
5355461305e8: Pull complete
ad1eec592342: Pull complete
e03fbc76cb78: Pull complete
1f5796e48b39: Pull complete
72fbe8e1d4e7: Pull complete
96edece66175: Pull complete
292dfb535cda: Pull complete
20d45132048e: Pull complete
5a29f1842d2f: Pull complete
edd6a10260cc: Pull complete
da400e036222: Pull complete
Digest: sha256:e8142907fdf14e700ae34b50e6b9637ea834a93912e41a3785341eb833b77c31
Status: Downloaded newer image for phpmyadmin:latest
Creating root_db_1 ... done
Creating root_phpmyadmin_1 ... done
Attaching to root_db_1, root_phpmyadmin_1
db_1 | 2022-01-19 20:46:06+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.5+maria~focal started.
phpmyadmin_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
phpmyadmin_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.18.0.3. Set the 'ServerName' directive globally to suppress this message
phpmyadmin_1 | [Wed Jan 19 20:46:07.008925 2022] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.51 (Debian) PHP/7.4.27 configured -- resuming normal operations
phpmyadmin_1 | [Wed Jan 19 20:46:07.011462 2022] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
db_1 | 2022-01-19 20:46:07+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
db_1 | 2022-01-19 20:46:07+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:10.6.5+maria~focal started.
db_1 | 2022-01-19 20:46:07+00:00 [Note] [Entrypoint]: Initializing database files
db_1 | 2022-01-19 20:46:08 0 [Warning] You need to use --log-bin to make --expire-logs-days or --binlog-expire-logs-seconds work.
db_1 |
db_1 |
db_1 | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
db_1 | To do so, start the server, then issue the following command:
db_1 |
db_1 | '/usr/bin/mysql_secure_installation'
db_1 |
db_1 | which will also give you the option of removing the test
db_1 | databases and anonymous user created by default. This is
db_1 | strongly recommended for production servers.
db_1 |
db_1 | See the MariaDB Knowledgebase at https://mariadb.com/kb or the
db_1 | MySQL manual for more instructions.
db_1 |
db_1 | Please report any problems at https://mariadb.org/jira
db_1 |
Step 7: Ping http://localhost:8080 in Browser
Step 8: Login with Database Credentials
Step 9: This is the PhpMyAdmin Dashboard
By this to install PhpMyAdmin by using Docker Compose on Ubuntu 21.04 has been completed