
unibz/wordpressThis documentation describes the WordPress Docker image alone.
unibz\wordpress:3.1.0, you have to update it to your needs): cd docker && docker build -t unibz/wordpress:3.1.0 .Once you built the image, for each new WordPress instance that you want to create, two steps are required:
/entrypoint-init.sh (it will inizialize stuff and then terminate)The initialization run expects to find an empty volume mounted on /root. The reason for that, is that the init entrypoint will just initialize WordPress using the default directory /var/www/html and finally copy all files to /root. After copying, the init entrypoint terminates and the volume and the database are ready to be attached to the final container.
Note: the apache log files directory is also copied to the volume.
For initialization, a number of environment variables is required:
MYSQL_HOST: the host where the MySQL database is locatedMYSQL_USER: the username for the connection to MySQLMYSQL_PASS: the password for the connection to MySQLMYSQL_NAME: the name of the databaseWP_FQDN: the fully qualified domain name that this WordPress is going to useWP_NAME: the title of the WordPress blogWP_ADMIN_USER: the username of the WordPress adminWP_ADMIN_MAIL: the email of the WordPress adminWP_ADMIN_PASS: the password of the WordPress adminICTADMIN_USERNAME: the username of the ICT WordPress adminICTADMIN_EMAIL: the email of the ICT WordPress adminICTADMIN_PASSWORD: the password of the ICT WordPress adminThe following variables are optional:
INSTANCE_SUPPORTED: if set to 1, the wordpress instance created will be supported (theme and plugins will be installed automatically, some default settings will be applied automatically)EXPIRY_DATE: optional text that will be added to /root/container-data.txt to identify the date after which the website can be decommissionedREQUEST_ID: optional text that will be added to /root/container-data.txt to identify the ticket that originates the current websiteYou can use this command as reference for running the initialization container:
$ docker run \ --rm \ # removes the init container after termination -it \ # in case of errors they will be printed to stdout --entrypoint=/entrypoint-init.sh \ # override the default entrypoint --name test.local-init \ # container name -h test.local \ # FQDN to instruct docker how to name the container --link mariadb.local:mariadb.local \ # used for mac os only (no linux), only in case the database is another container -v /path/to/volume/test.local:/root \ # bind mount of a volume to the container /root directory -e MYSQL_HOST=mariadb.local \ # mysql host -e MYSQL_USER=wp_user \ # mysql username -e MYSQL_PASS=wp_pass \ # mysql password -e MYSQL_NAME=wp_db \ # mysql database name -e WP_FQDN=test.local \ # FQDN to instruct WordPress on what address to listen on -e WP_NAME=Test \ # WordPress blog title -e WP_ADMIN_USER=giuroman \ # WordPress admin username -e WP_ADMIN_MAIL=*** \ # WordPress admin email address -e WP_ADMIN_PASS=secret111 \ # WordPress admin password -e ICTADMIN_USERNAME=ictadmin \ # ICT WordPress admin username -e ICTADMIN_EMAIL=*** \ # ICT WordPress admin email address -e ICTADMIN_PASSWORD=password123 \ # ICT WordPress admin password -e INSTANCE_SUPPORTED=1 \ # Supported instance (optional) -e EXPIRY_DATE=2099-12-31 \ # Expiry date (optional) -e REQUEST_ID=*** \ # ID of the ticket behind this website (optional) unibz/wordpress:3.1.0
The initialization script returns the following status codes on exit:
Now that the volume and the database were initialized, they preserve the state of the WordPress site, and the final container can be started. To run successfully, the container expects subdirectories of the volume used in step 1 to be mounted to different places:
| File/directory on the host | Mount point in the container |
|---|---|
/path/to/volume/container-data.txt | /root/container-data.txt |
/path/to/volume/html | /var/www/html |
/path/to/volume/apache2 | /var/log/apache2 |
Use this command as reference for running the container:
$ docker run / -d / # substitute to -it in case you need to debug this step --name test.local / # container name -h test.local / # FQDN to instruct docker how to name the container --link mariadb.local:mariadb.local / # optional: just in case your database is another container -p 80:80 / # expose port 80 on the host and bind it to port 80 on the container -v /path/to/volume/test.local/container-data.txt:/root/container-data.txt / # the existence of this file is a flag to tell the container that it can start -v /path/to/volume/test.local/html:/var/www/html / # web root -v /path/to/volume/test.local/apache2:/var/log/apache2 / # apache log directory --restart always / # auto restart in case of crash unibz/wordpress:3.1.0
If the container terminates with status code 1, it means that the file /root/container-data.txt was not found, meaning that you are trying to use a volume that has not beed initialized.


manifest unknown 错误
TLS 证书验证失败
DNS 解析超时
410 错误:版本过低
402 错误:流量耗尽
身份认证失败错误
429 限流错误
凭证保存错误
来自真实用户的反馈,见证轩辕镜像的优质服务