DEV Community

Pierangelo
Pierangelo

Posted on

Joomla + MySql + phpMyAdmin in Docker

MYSQL

First step open the terminal and download MySql Docker Image:

docker pull mysql
Enter fullscreen mode Exit fullscreen mode

After we can start our instance, we will named it test-mysql, root as user and 12345678 as password.

After we must to create a “volumes”, a local folder from the host on the container to store the database files.

docker run --name test-mysql -v /Your/LocalPath/Desktop/mysql-nginx/datadir:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=12345678 -d mysql
Enter fullscreen mode Exit fullscreen mode

By default, our mysql should be run on port 3306.

phpMyAdmin

Download phpMyAdmin Docker Image

docker pull phpmyadmin/phpmyadmin
Enter fullscreen mode Exit fullscreen mode

Now we start the instance, naming it test-phpmyadmin and link it to the database mysql test-mysql that we have created before, and run it on the port 8084.

docker run --name test-phpmyadmin -d --link test-mysql:db -p 8084:80 phpmyadmin/phpmyadmin
Enter fullscreen mode Exit fullscreen mode

Now, if we connect with our browser at the address http://localhost:8084 we should have phpMyAdmin login page, and we can access with username: root and password: 12345678

image-title-here{:class="img-fluid"}

Joomla

Ok, now it’s the turn of Joomla, as already done before, we must download the image:

docker pull joomla
Enter fullscreen mode Exit fullscreen mode

Now we start the instance on the port 8080 with the name of test-joomla, link it at the database and create a volumes.

docker run --name test-joomla --link test-mysql:db -e JOOMLA_DB_HOST=db:3306 -e JOOMLA_DB_USER=root -e JOOMLA_DB_PASSWORD=12345678 -v /your/local/path/Desktop/joomla-docker/joomla_www:/var/www/html -p 80:80 -d joomla
Enter fullscreen mode Exit fullscreen mode

if it’s all correct, at the address http://localhost we should find our joomla installation.

Top comments (3)

Collapse
 
rdipalma profile image
rdipalma

Hello.
Interesting article. I tried. I wanted to test data persistence. I restarted the vm. But when I run the command, I get this:
Hello.
Interesting article. I tried. I wanted to test data persistence. I restarted the vm. But when I run the command, I get this:
docker: Error response from daemon: Conflict. The container name "/test-joomla" is already in use by container "b7d58eb3dcfebf0089dca14fbec8a4b0adf225e854646c207bfd40d1b2786318". You have to remove (or rename) that container to be able to reuse that name
.
Why?
Thanks

Collapse
 
pierangelo1982 profile image
Pierangelo

you must delete old container rm -rf test-joomla... recreate e new one...

Collapse
 
rmoggia profile image
Rosario Moggia

Thank you