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

How to use cutecom for serial communication in Ubuntu virtual machine

Using cutecom for serial communication in Ubuntu ...

WeChat applet realizes the nine-square grid effect

This article shares the specific code for the WeC...

JavaScript parseInt() and Number() difference case study

Learning objectives: The two functions parseInt()...

How to install Docker on Windows Server 2016

Recently Microsoft released Windows Server 2016, ...

SQL implementation of LeetCode (184. The highest salary in the department)

[LeetCode] 184. Department Highest Salary The Emp...

MySQL multi-instance installation boot auto-start service configuration process

1.MySQL multiple instances MySQL multi-instance m...

Solve the problem that Docker must use sudo operations

The steps are as follows 1. Create a docker group...

mysql is not an internal command error solution

The error "mysql is not an internal command&...

W3C Tutorial (5): W3C XML Activities

XML is designed to describe, store, transmit and ...

How to use pdf.js to preview pdf files in Vue

When we preview PDF on the page, some files canno...

Vue interpretation of responsive principle source code analysis

Table of contents initialization initState() init...

The use of FrameLayout in six layouts

Preface In the last issue, we explained LinearLay...

Vue implements simple calculator function

This article example shares the specific code of ...

Several ways to solve CSS style conflicts (summary)

1. Refine the selector By using combinators, the ...

How to view and modify the time zone in MySQL

Today I found that a program inserted an incorrec...