Super simple implementation of Docker to build a personal blog system

Super simple implementation of Docker to build a personal blog system

Install Docker

Update the yum package to the latest version: sudo yum update
Install the required packages: sudo yum install -y yum-utils device-mapper-persistent-data lvm2
Set the yum source to Alibaba Cloud, otherwise it will be very slow: sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum install docker-ce
Check the docker version after installation: docker -v
Set up a domestic mirror, ustc is a veteran Linux mirror service provider: vi /etc/docker/daemon.json
Enter the following content in the file:

{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"]
}

Start Docker: systemctl start docker
Check the docker status: systemctl status docker
Start at boot: systemctl enable docker

Install the image

The data of the blog system is recorded in the database, which means it depends on the database, so you need to install the database first: docker run --name db --env MYSQL_ROOT_PASSWORD=example -d mariadb
db is the name of the docker container, -d means starting it in daemon mode (running in the background), mariadb is a database of mysql, docker will first search for the mariadb image locally, if it is not found, it will automatically download it from the warehouse

View the docker container status: docker ps -a

Install the wordpress blog system: docker run --name MyWordPress --link db:mysql -p 8080:80 -d wordpress
Use --link db:mysql parameter to establish a connection between WordPress and the database. Use -p 8080:80 parameter to map port 80 of the original service to port 8080 of the host machine.

insert image description here

View the docker container status: docker ps -a

insert image description here

Visit site

Visit the browser: http://192.168.2.9:8080
The host machine's IP is 192.168.2.9 , and the response is as follows:

insert image description here

After some simple settings, our blog system is set up

insert image description here

This is the end of this article about how to use Docker to build a personal blog system. For more information about building a blog system with Docker, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Example of using Docker to build an ELK log system
  • How to build an elk system using docker compose
  • How to build a docker local image warehouse under centos7 system
  • Using Docker to build a lamp environment on Mac

<<:  HTML table tag tutorial (23): row border color attribute BORDERCOLORDARK

>>:  How to use VUE to call Ali Iconfont library online

Recommend

Usage of Vue filters and timestamp conversion issues

Table of contents 1. Quickly recognize the concep...

Summary of examples of common methods of JavaScript arrays

Table of contents Common array methods concat() M...

Linux disk space release problem summary

The /partition utilization of a server in IDC is ...

9 super practical CSS tips to help designers and developers

A web designer's head must be filled with a lo...

Detailed explanation of the loading rules of the require method in node.js

Loading rules of require method Prioritize loadin...

How to import Tomcat source code into idea

Table of contents 1. Download the tomcat code 2. ...

Detailed explanation of MySQL/Java server support for emoji and problem solving

This article describes the support and problem so...

Using NTP for Time Synchronization in Ubuntu

NTP is a TCP/IP protocol for synchronizing time o...

React gets input value and submits 2 methods examples

Method 1: Use the target event attribute of the E...

Tutorial on installing MySQL database and using Navicat for MySQL

MySQL is a relational database management system ...

Commonplace talk about the usage of MYSQL pattern matching REGEXP and like

like LIKE requires the entire data to match, whil...

HTML implements read-only text box and cannot modify the content

Without further ado, I will post the code for you...

How to deploy MongoDB container with Docker

Table of contents What is Docker deploy 1. Pull t...

Summary of how to use bootstrap Table

This article shares with you how to use bootstrap...

Detailed explanation of how to solve the problem of too long content in CSS

When we write CSS, we sometimes forget about the ...