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

HTML end tag issue and w3c standard

According to the principles of W3C, each start tag...

vite2.x implements on-demand loading of ant-design-vue@next components

1. Use version vite:2.0 ant-design-vue: 2.0.0-rc....

Let's talk about what JavaScript's URL object is

Table of contents Overview Hash Properties Host p...

Ideas and practice of multi-language solution for Vue.js front-end project

Table of contents 1. What content usually needs t...

React's context and props explained

Table of contents 1. context 1. Usage scenarios 2...

vue-pdf realizes online file preview

This article example shares the specific code of ...

Detailed explanation of Vue life cycle functions

Table of contents Lifecycle Functions Common life...

A brief introduction to JavaScript arrays

Table of contents Introduction to Arrays Array li...

Embed codes for several older players

The players we see on the web pages are nothing m...

Discussion on horizontal and vertical centering of elements in HTML

When we design a page, we often need to center th...

HTML table markup tutorial (18): table header

<br />The header refers to the first row of ...

XHTML Web Page Tutorial

<br />This article is mainly to let beginner...

Example code for implementing a hollow mask layer with CSS

Contents of this article: Page hollow mask layer,...

Several skills you must know when making web pages

1. z-index is invalid in IE6. In CSS, the z-index...