Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build wordpress by Docker

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how to build wordpress in Docker". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to build wordpress in Docker" can help you solve the problem.

First, take care of mysql.

1.search

$docker search mysql name description stars official automated mysql mysql is a widely used, open-source relati... 456 [ok]

2.pull

$docker pull mysql

Secondly, consider the combination of the two.

$docker images repository tag image id created virtual size wordpress latest ecc04d6d638c 2 weeks ago 470 mb mysql latest aca96d9e6b5c 2 weeks ago 282.7 mb

The wordpress startup command goes like this:

The copy code is as follows:

$sudo docker run-- name some-wordpress-- link some-mysql:mysql-d wordpress

Some of the environment parameters that can be specified when starting the wordpress container include

-e wordpress_db_user=... The default is "root"

-e wordpress_db_password=... The default is the value of the environment variable mysql_root_password that connects to the mysql container

-e wordpress_db_name=... The default is "wordpress"

-e wordpress_auth_key=...,-e wordpress_secure_auth_key=...,-e wordpress_logged_in_key=...,-e wordpress_nonce_key=...,-e wordpress_auth_salt=...,-e wordpress_secure_auth_salt=...,-e wordpress_logged_in_salt=...,-e wordpress_nonce_salt=... The default is random sha1 string

For the startup command for wordpress, we need to target:

1. You can give wordpress a name. It's easy.

The 2.--link parameter, which requires us to start mysql first and then link its name to it

3. Port-p parameter, the default is port 80, but it is occupied by me, here we map to 8080

The command of the launched mysql:

The copy code is as follows:

$docker run-- name mysql_wordpress-e mysql_root_password=wordpress-d mysql

The password of mysql is exposed in this way.

The startup command for the corresponding mysql,wordpress is as follows:

The copy code is as follows:

$docker run-- name docker_wordpress-- link mysql_wordpress:mysql-p 8080 wordpress 80-d wordpress

Then you can type http://localhost:8080 into the browser to configure wordpress.

Enjoy!

Third, use fig to configure

Practice has proved that using fig configuration is the best way. Based on the above, we only need to create a new directory such as wordpress-docker under our docker directory, and then create the fig configuration file fig.yml as follows:

Wordpress: image: "wordpress:latest" ports:-"8080 links:-db:mysql db: image:" mysql:latest "expose: -" 3306 "environment:-mysql_root_password=wordpress

You only need to execute fig up-d in this directory for each startup!

This is the end of the introduction to "how Docker builds wordpress". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report