---
title: 'How to install phpMyAdmin in Docker | Zomro'
description: 'In this article, we will look at how to install phpMyAdmin in a Docker container, also review the syntax of the docker-compose file, and perform the installation.'
image: 'https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736570_1.png'
---

![opened image]()

  * [Zomro](https://zomro.com/)
  * [FAQ](https://zomro.com/blog/faq/)
  * How to install phpMyAdmin in Docker 



# How to install phpMyAdmin in Docker

20-11-2022

In this article, we will look at how to install phpMyAdmin in a Docker container, as well as the syntax of the docker-compose file and also perform the installation.  


## **Installing Docker**

We update the OS packages.   

    
    
    apt update

  
We will install the necessary packages and add a new repository:
    
    
    apt install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
    
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
    
    add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

  
Now we will update the packages with the new repository:
    
    
    apt update

Now we will install Docker itself.
    
    
    apt-get install docker-ce docker-ce-cli containerd.io

  
We check the Docker version:
    
    
    docker --version

  
![How to install phpMyAdmin in Docker - 1](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736570_1.png)Let's check the status:
    
    
    systemctl status docker

  
![How to install phpMyAdmin in Docker - 2](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736593_2.png)  
If it did not start, we start it:
    
    
    systemctl start docker
    

  
And add it to autostart.
    
    
    systemctl enable docker
    

  
![How to install phpMyAdmin in Docker - 3](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669736594_4.png)

## **Let's install Docker-Compose**
    
    
    curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    

We set the execution permissions. 
    
    
    chmod +x /usr/local/bin/docker-compose
    

  
We check how Docker-Compose was installed:
    
    
    docker-compose --version
    

  
![How to install phpMyAdmin in Docker - 4](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669740139_5.png)  
  
Let's create a ***.yaml** file for Docker-Compose.  
  
To orient ourselves in the future about where and what we have installed, we will create a separate folder for this project in the **/home** directory and navigate to it.
    
    
    mkdir /home/phpmyadmin && cd /home/phpmyadmin

  
You can also use another directory**** to place this and other projects.   
  
We will use the repository to create the **docker-compose.yaml** file at the link <https://hub.docker.com/_/phpmyadmin>  
  
We create the file **docker-compose.yaml** or **docker-compose.yml** ,
    
    
    vim docker-compose.yaml
    

  
And add the following code to it:
    
    
    version: '3.1'
    
    services:
      phpmyadmin:
        image: phpmyadmin
        restart: always
        ports:
          - 8090:80
        environment:
          - PMA_ARBITRARY=1

  
![How to install phpMyAdmin in Docker - 5](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669812444_docker-admin.png)  
Where:  
  
**phpmyadmin:** the name of your container;  
**image: phpmyadmin:** the image from which phpmyadmin will be deployed  
**8090:80** \- port 8090 that we will use to connect to phpmyadmin  
**restart:always** \- indicates that the container will be restarted in case of failure or server reboot  
**PMA_ARBITRARY=1** \- indicates that it is possible to connect to an arbitrary database server (How to bind the phpmyadmin panel to a specific server can be found in [this ](https://zomro.com/rus/blog/faq/290-kak-ustanovit-mariadb-v-docker)article)  
  
We run our script (for this you need to be in the directory where our file was created. In this case, it is **/home/phpmyadmin**):
    
    
    docker-compose up -d 

We wait for the images to download and deploy.  
  
We check:
    
    
    docker-compose ps

or 
    
    
    docker ps

  
![How to install phpMyAdmin in Docker - 6](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669812849_docker-admin2.png)  
To view the logs, use the command 
    
    
    docker logs -f phpmyadmin
    

  
You can also perform the installation only in docker:
    
    
    docker run -d --restart always --name phpmyadmin -e PMA_ARBITRARY=1 -p 8090:80 phpmyadmin

  
  
To connect to **phpmyadmin** — open your browser and go to the address — http://YOUR_IP_SERVER:8090/   
  
![How to install phpMyAdmin in Docker - 7](https://dx86q6oq7ry0e.cloudfront.net/uploads/media/blog/a48@server-panel.net/2022/11/01/1669814059_screenshot_3.png)  
Now we can connect to the database server.  
In the **Server** field, enter the IP of the database server, in the **Username** field - the user (in this case, it is root), in the **Password** field - the password of the root user of the database server.  
  
If you have not yet installed the database server in Docker, then in the article **How to install MariaDB in Docker** we will look at how to do this, and see how to deploy this database server along with **phpMyAdmin**.

We also suggest looking at other useful articles:

  * [How to install and configure phpMyAdmin on Windows Server](https://zomro.com/blog/faq/367-how-to-install-and-configure-phpmyadmin-on-windows-server)
  * [How to access phpMyAdmin from popular server control panels](https://zomro.com/blog/faq/389-in-this-article-we-will-look-at-how-to-use-phpmyadmin-to-importexport-databases-on-various-control-panels-such-as-ispmanager-cpanel-vestacp-and-hestiacp-how-to-get-into-phpmyadmin-from-popular-server)
  * [Additional database server in HestiaCP + native phpmyadmin](https://zomro.com/rus/blog/faq/470-additional-database-server-in-hestiacp-native-phpmyadmin)



Similar articles:

[Creating Minecraft Java Servers.](https://zomro.com/blog/faq/325-creating-minecraft-java-servers) [How to upload files to server for Forex?](https://zomro.com/blog/faq/182-kak-zagruzhat-fajly-na-server-dlja-forex) [Dockerfile: A Complete Guide for Beginners and Professionals](https://zomro.com/blog/faq/477-dockerfile-a-complete-guide-for-beginners-and-professionals) [How to install Python 3.10 on CentOS 7](https://zomro.com/blog/faq/294-kak-ustanovit-python-310-na-centos-7) [Installing and configuring the Squid proxy server in Linux.](https://zomro.com/blog/faq/377-installing-and-configuring-the-squid-proxy-server-in-linux)

[ Dedicated servers from €88.80/mon ](/dedicated-servers)
