I have been searching everywhere but I did not come any good working method to host phpmyadmin on dokku.
I tried to different options but couldn’t get to a working solution to host phpmyadmin and connect to mysql server on dokku.
I have been searching everywhere but I did not come any good working method to host phpmyadmin on dokku.
I tried to different options but couldn’t get to a working solution to host phpmyadmin and connect to mysql server on dokku.
2
Answers
I could finally host phpmyadmin on dokku. Here are the detail steps for the same.
Step 1: Pull the Docker Image
Start by pulling the official phpMyAdmin Docker image:
Step 2: Create a Dokku App
Create a new Dokku app named
phpmyadmin
:Step 3: Deploy the Docker Image
Deploy the Docker image to the Dokku app using the
git:from-image
command:Step 4: Create a MySQL Database
Assuming you have the Dokku MySQL plugin installed, create a new MySQL database:
Step 5: Link the Database
Link the newly created MySQL database to the
phpmyadmin
app:Step 6: Set Environment Variables
Extract the database host name from the DSN provided by the Dokku MySQL plugin and set it as an environment variable for phpMyAdmin. You may need to set additional environment variables such as
PMA_USER
andPMA_PASSWORD
for your phpMyAdmin user credentials[1].Step 7: Configure Apache ServerName
Build and deploy the custom Docker image:
Replace
my-custom-phpmyadmin
with the name of the directory containing your Dockerfile.Step 8: Set Port Configuration
Set the port configuration for the
phpmyadmin
app to map HTTP port 80 to the container's port 80:Step 9: Additional Configuration
Set any additional environment variables required by phpMyAdmin:
Step 10: Verify Deployment
Verify that the
phpmyadmin
app is running correctly by visiting the app's domain in your web browser.Additional Notes
Ensure you have the latest version of Dokku and all plugins are up to date.
Replace
demodb
with the actual name of your MySQL database.Replace
localhost
in the Dockerfile with your server's FQDN or IP address if available.The Dokku MySQL plugin can be installed with:
Check your Dokku version with
dokku --version
and update if necessary.By following these steps, you should have a working installation of phpMyAdmin on your Dokku instance. Remember to secure your phpMyAdmin instance by using environment variables for credentials and consider using SSL/TLS for secure connections.
I ended up just using MySQL Workbench connecting to my host via ssh. On the host, I exposed my mysql db to a port
dokku mysql:expose <db_name> <port>
.