Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build a blog with docker

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces you how to use docker to build a blog, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Today, let's learn the simplest website building.

Show the effect first:

Home page effect

Blog page

Docker is used in this building, and there is no need to worry about the newly bought server. I wrote the command to build the blog into a script for the children who need it to learn. The following is the practice on the Centos7.4 linux system.

The yum source on the new server is configured by default, and we don't have to worry about this in the / etc/yum.repos.d/ directory.

1. Run the following script:

#! / bin/bash

# the first step is to install docker

Yum install docker.x86_64-y

# start docker after installation is complete

Systemctl start docker

# data directory to be mounted

BlogDir=/root/mywebsite/ghost/content

# create a directory

Mkdir-p ${blogHome}

# start the service

Docker run-- restart always-d-- name blog-v ${blogDir}: / var/lib/ghost/content-p 2368 name blog 2368 ghost:alpine

Parameter description:

Docker run: means to run a container, which can be thought of as running a program

-- restart always: indicates that the program restarts automatically if it dies, ensuring that your blog provides services all the time.

-d: run your program in the background

Name blog gives your program a name, and blog can change it into any English letter.

-v ${blogDir}: / var/lib/ghost/content means to put a local directory into the container. Note: this directory is the folder of blog content in the container. This is done here so that when you delete the container, the content you have written can be retained, so that the next time you press this command, the content you wrote will not be lost.

-p 2368 rig 2368 maps a port in the container to your host (that is, the server you operate)

Ghost:alpine image name, which will be pulled from the default image warehouse the first time it runs.

2. Type in your browser:

IP:2368 of the http:// server

There should be a connection timeout at this point because the port on the new server is not open. You need to do the following:

Open port. The following video is operated on Aliyun app on mobile:

3. Enter the IP:2368/admin of the http:// server in your browser to enter the configuration of the blog:

Then, after you need to enter your personal information, go to the next step to invite friends, and you can choose to skip

On how to use docker to build a blog to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report