Install Adminer Inside Docker Container in Linux

Install Adminer Inside Docker Container in Linux

Adminer is an open-source database management tool through a web browser. It supports MySQL, MariaDB, SQLite, PostgreSQL, and various other database servers.

This tutorial explains how to install Adminer inside a Docker container in the Linux. Commands have been tested on Ubuntu.

Prepare environment

Make sure you have installed Docker in your system. If you are using Ubuntu, installation instructions can be found in the post.

You also need to have a running MySQL container. Instructions can be found in the post.

Install Adminer

  • Host network

Run the following command to create a container for Adminer that uses host network:

docker run -d --name=adminer --restart=always --network=host \
    -e ADMINER_DEFAULT_SERVER=127.0.0.1 \
    adminer

MySQL container should run on host network as well.

  • User-defined bridge network

User-defined bridge network can be used for listening on different port. By default, Adminer service is listening on port 8080. It can be changed with -p option.

docker network create app-net
docker run -d --name=adminer --restart=always --network=app-net \
    -p 8081:8080 \
    -e ADMINER_DEFAULT_SERVER=mysql \
    adminer

MySQL container should run on the same user-defined bridge network as well.

Note: When user-defined bridge network is used, don't forget to change ADMINER_DEFAULT_SERVER. It specifies MySQL container name.

Testing Adminer

Open a web browser and go to http://<IP_ADDRESS>, where <IP_ADDRESS> is the IP address of the system. Provide username and password to log in to database server.

Install Adminer Inside Docker Container in Linux

Uninstall Adminer

To completely remove Adminer, remove its container:

docker rm --force adminer

Remove Adminer image:

docker rmi adminer

If a user-defined bridge network was created, you can delete it as follows:

docker network rm app-net

Leave a Comment

Cancel reply

Your email address will not be published.