WordPress is a very popular open source blog system, today use Docker + WordPress to build personal blog, the whole process is very smooth.

Take blog first to prepare domain name and server, yesterday in Ali cloud bought a. Top domain name spent 5 dollars (zizi ~ ~), originally ready to ali cloud then choose a lightweight application server to see the cheapest are also 600+ a year, went to the next Tencent spent 88 to buy a 1 core + 2G server is still good.

Install the Docker

Installing Dokcer is relatively simple and the arrangement is clear after a few lines of command:

  1. Update apt repository index
sudo apt-get update
Copy the code
  1. Install software to allow APT to use HTTPS software sources
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
Copy the code
  1. Add Docker official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
Copy the code
  1. Add the official Docker source
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
Copy the code
  1. Update apt repository index
sudo apt-get update
Copy the code
  1. Install the Docker
sudo apt-get install docker-ce
Copy the code

After installing Docker, try again:

sudo docker run hello-world
Copy the code

If it’s okay the console will print Hello from Docker! .

Install using Docker-compose

Docker-compose is a very lightweight docker window composition tool, very easy to use. Installation is also required for first use, but the process is relatively simple:

Sudo curl - L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname - s) - $(uname -m)" - o /usr/local/bin/docker-composeCopy the code
sudo chmod +x /usr/local/bin/docker-compose
Copy the code

Docker-compose installation and then go to docker Hub to find a suitable WordPress image. WordPress is very friendly to Docker and provides two forms of deployment image respectively:

  • php + apache
  • php + fpm

I use PHP + Apache if you have deployed Nginx can consider using PHP + FPM, because my machine is new, choose the fastest and most convenient solution 1 to deploy. Without further ado, let’s get real!

Create a new directory called arch:

mkdir -p arch
Copy the code

Then use vi to add a docker-comemage. yaml file to copy the following:

version: '3.1'

services:
  wordpress:
    image: WordPress: php7.3 - apache
    restart: always
    ports:
      - 80: 80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: 123456
      WORDPRESS_DB_NAME: ArchDigest
    volumes:
      - ./www/html:/var/www/html

  db:
    image: Mysql: 5.7
    restart: always
    environment:
      MYSQL_DATABASE: ArchDigest
      MYSQL_ROOT_PASSWORD: 123456
    volumes:
      - ./mysql:/var/lib/mysql
Copy the code

Install WordPress and Mysql, save the file and execute the command in arch directory:

docker-compose up -d 
Copy the code

Look at the console, and if there are no exceptions, it will say startup complete:

Creating network "arch-digest_default" with the default driver
Creating arch-digest_wordpress_1 ... done
Creating arch-digest_db_1        ... done
Copy the code

Start WordPress and Mysql and wait 2 seconds to access your blog. Very convenient and fast, less than ten minutes to build a blog, finally don’t forget to open the server 80 goods, set up domain name resolution!!

Amway several widgets/themes

  • WP editor. md: Markdown Editor
  • Bee collection: collection of public articles
  • Kratos: A great topic for blogs, see the Architecture Digest blog for details