Linux Docker Install WordPress method of detailed tutorial _docker

Source: Internet
Author: User
Tags install wordpress docker ps docker run

Install MySQL Service

Download MySQL Mirror:

Docker pull MySQL

Create the MySQL container and run in the background, specifying the database password is 123456. -e Specifies environment variables.

Docker run--name mysql_db-e mysql_root_password=123456-d MySQL

Using the official WordPress

WordPress Mirror Daocloud.io:

Docker Pull Daocloud.io/daocloud/dao-wordpress:latest

Please login before pulling Mirror: Docker login Daocloud.io (login with username).

Or use the official WordPress image:

Docker pull WordPress

Create a WordPress container application and run it in the background:

Docker run--name some-wordpress--link mysql_db:mysql-p 8001:80-d daocloud.io/daocloud/dao-wordpress

You can then access the site in the browser via http://localhost:8001 (or http://host-ip:8001).

If you want to use the external database, you can set up the corresponding database through the above environment variables:

$ docker Run--name some-wordpress-e wordpress_db_host=10.1.2.3:3306 \
  e wordpress_db_user= ...-e WORDPRESS_DB_ password= ...-d WordPress

More Environment variables:

Wordpress_db_host Database host address (defaults to the IP and 3306 port of the MySQL container with its link:: 3306)
Wordpress_db_user database user name (default is root)
Wordpress_db_password Database Password (defaults to the value of the Mysql_root_password variable supplied with the MySQL container for its link)
Wordpress_db_name database name (default is WordPress)
Wordpress_table_prefix database table name prefix (default is null, you can overwrite configuration in wp-config.php from this variable)

Security-related (default is random SHA1 value)

Wordpress_auth_key
Wordpress_secure_auth_key
Wordpress_logged_in_key
Wordpress_nonce_key
Wordpress_auth_salt
Wordpress_secure_auth_salt
Wordpress_logged_in_salt
Wordpress_nonce_salt

If the database specified by the Wordpress_db_name variable does not exist, the WORDPRESS container will automatically attempt to create the database when it starts, but the user specified by the Wordpress_db_user variable needs to have permission to create the database.

Dockerfile Warehouse: https://github.com/docker-library/wordpress

Use Fig Choreography

Fig is Docker's application Choreography tool, which is mainly used to build complex applications based on Docker with Docker, which manages multiple Docker containers with a single configuration file that is ideal for combining multiple containers for development scenarios. The fig has now been upgraded and renamed compose. Compose backward compatible fig.

The application of choreography tools makes Docker application management more convenient and quicker. Fig site: http://www.fig.sh/

Installation Fig:

# method One:
curl-l https://github.com/docker/fig/releases/download/1.0.1/fig-' uname 
-S '-' uname-m ' >/usr/ Local/bin/fig; chmod +x/usr/local/bin/fig
# Method II:
yum install python-pip python-dev
pip install-u Fig

Write Fig.yml:

WordPress:
 image:daocloud.io/daocloud/dao-wordpress:latest
 Links:
  -db:mysql
 ports:
  -" 8002:80 "
db:
 image:mysql
 Environment:
  -mysql_root_password=123456
Deployment application:
# start
Fig Up
# Start and run in the background
fig up-d

You can then access the site in the browser via http://localhost:8002 (or http://host-ip:8002).

Fig Logs View Log
Fig Port view Port mappings

Use of external network

WordPress:
 image:daocloud.io/daocloud/dao-wordpress:latest
 Environment:
  -wordpress_db_host= 119.119.192.246:3306
  -Wordpress_db_user=root
  -wordpress_db_password=123456
 ports:
  -"80"

Fig command:

# Stop
Fig Stop
# View log
Fig Logs 
# view ports 
Fig Port
# Uninstall Fig:
pip uninstall Fig
# Version:
Fig--version

Note: Fig has been upgraded to Compose:https://github.com/docker/compose

Batch Processing

# Close all running containers
Docker PS | awk ' {print} ' | Xargs docker stop
# Remove all container applications
Docker ps-a | awk ' {print} ' | xar GS Docker RM

The above is a small set to introduce the Linux Docker installation WordPress method of detailed tutorials, I hope to help you, if you have any questions welcome to my message, small series will promptly reply to everyone.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.