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:
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.
In recent years, artificial intelligence (AI) has evolved to include more sophisticated and capable agents,…
Adaptive learning helps in tailoring learning experiences to fit the unique needs of each student.…
With the increasing demand for more powerful machine learning (ML) systems that can handle diverse…
Anxiety is a common mental health condition that affects millions of people around the world.…
In machine learning, confounder features or variables can significantly affect the accuracy and validity of…
Last updated: 26 Sept, 2024 Credit card fraud detection is a major concern for credit…