FROM node:15.7.0-alpine3.10
WORKDIR /usr/blog
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add bash git openssh
RUN apk add tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
&& echo "Asia/Shanghai" > /etc/timezone \
&& apk del tzdata
RUN \
npm config set registry https://registry.npm.taobao.org \
&&npm install \
&&npm install hexo-cli -g \
&& npm install hexo-server --save \
&& npm install hexo-asset-image --save \
&& npm install hexo-wordcount --save \
&& npm install hexo-generator-sitemap --save \
&& npm install hexo-generator-baidu-sitemap --save \
&& npm install hexo-deployer-git --save \
&& npm install hexo-admin --save
EXPOSE 4000
docker build .
docker images
docker tag 【镜像id】 hexo
mkdir ~/hexo
docker run -d -it -p 4000:4000 -v ~/hexo:/usr/blog/ hexo /bin/bash
title: Link2Points
subtitle: ''
description: "Link2Points' Blog"
keywords: Tech, Study
author: Link2Points
language: zh-Hans
timezone: 'Asia/Shanghai'
theme: next
docker ps
docker exec -it 【容器id】 /bin/bash -c "hexo g"
docker exec -it 【容器id】 /bin/bash -c "hexo s -d &"
- 访问ip:4000/admin,设置密码
![](https://i-blog.csdnimg.cn/blog_migrate/f923205e9bf7a7b97e2591ec69098def.png)
- 将生成的加密结果添加到~/hexo/_config.yml文件中
- 由此添加标题撰写博客(Markdown)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/bf4ebe75ee5d4c175cf1aa00ac38d227.png)