Wordpress mysql installation using Docker
WordPress or PHP developers may find it difficult to do a fresh installation of WordPress and MySQL in a quick manner. This is where Docker comes to rescue. With Docker, one can quickly commission (or setup or install) and de-commission WordPress & MySQL development environment in no time.
In this post, you will learn about some of the following:
Before getting started with WordPress/MySQL , first and foremost, Docker needs to be installed. Briefly speaking, Docker platform is the container platform to build, secure and manage the widest array of applications from development to production both on premises and in the cloud. The greater details can be found on this page, What is Docker?
Docker platform comes in two different editions: community and enterprise edition.
For development purpose, community edition would suffice. Details on how to install Docker can be found on this page, Install Docker.
The following is the code for docker-compose file. Save the code in a file, say, wordpress-installation.yml
version: "2.0" services: wordpress: image: wordpress restart: always ports: - 8090:80 environment: WORDPRESS_DB_PASSWORD: root mysql: image: mysql:5.7 restart: always environment: MYSQL_ROOT_PASSWORD: root
In above docker compose file, pay attention to some of the following:
Execute the following command for installing wordpress and MySQL:
docker-compose -f wordpress-installation.yml up
Open a browser and access wordpress installation by typing URL as http://localhost:8090 or http://192.168.99.100:8090/. You would see the first page such as following:
Figure 1. WordPress Installation from Browser
Execute the following command to view all the containers:
docker ps
The wordpress container may be identified with name such as “documents_wordpress_1”. Access the wordpress with command such as following:
docker exec -ti documents_wordpress_1 /bin/bash
You would be taken to the folder “/var/www/html”. Execute command such as “ls -l” to check all the files.
Execute the following command to view all the containers:
docker ps
The wordpress container may be identified with name such as “documents_mysql_1”. Access the wordpress with command such as following:
docker exec -ti documents_mysql_1 /bin/bash
Execute following command to access the MySQL database:
mysql -u root -proot show databases; use wordpress;
In this post, you learned about installing WordPress and MySQL using Docker. Did you find this article useful? Do you have any questions or suggestions about this article in relation to installing WordPress and MySQL using Docker? Leave a comment and ask your questions and I shall do my best to address your queries.
Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…
Hey there! As I venture into building agentic MEAN apps with LangChain.js, I wanted to…
Software-as-a-Service (SaaS) providers have long relied on traditional chatbot solutions like AWS Lex and Google…
Retrieval-Augmented Generation (RAG) is an innovative generative AI method that combines retrieval-based search with large…
The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…
Have you ever wondered how to use OpenAI APIs to create custom chatbots? With advancements…