An Interest In:
Web News this Week
- April 25, 2024
- April 24, 2024
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
How Install WordPress with Docker
What you need in order to get this to work successfully.
- Docker
- Docker Compose
Step 1:
This first thing that you need to do is to create a project folder to work in, and inside the project folder you create Docker Compose file.
Open a Terminal or Command Prompt inside the project directory and run the command below.
touch docker-compose.yaml
Step 2:
Open the docker-compose.yaml file using a text editor of your choice.
Step 3:
Write the code below inside the docker-compose.yaml file and save.
version: '3.8'services: wordpress: image: wordpress restart: always ports: - '8080:80' environment: WORDPRESS_DB_HOST: db WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpress WORDPRESS_DB_NAME: wordpress volumes: - wordpress:/var/www/html db: image: mysql:5.7 restart: always environment: MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress MYSQL_RANDOM_ROOT_PASSWORD: '1' volumes: - db:/var/lib/mysqlvolumes: wordpress: db:
Step 4:
Go back to the Terminal or Command Prompt shell that you opened earlier, and enter the command below.
docker-compose up
Docker Compose shall execute the script and install the WordPress and MySQL images from docker hub.
It will then go ahead and Spin up two containers, one for each image.
Wait for about 1 minutes after docker-compose shows done for both containers before you can load WordPress on your browser.
Step 5:
Navigate to http://localhost:8080
on your browser, and this is the page you should expect to see.
Links:
Visit this GitHub repository, it has everything you need.
Original Link: https://dev.to/georgeomara/how-install-wordpress-with-docker-5c69
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To