两行命令,利用Ghost的Docker镜像快速搭建个人博客
💡
本博客即由Ghost的Docker镜像快速搭建成型
docker配置
2024大陆安装docker教程
Docker被墙 2024年11月docker官方仓库仍处被墙状态。 对于开发者及运维人员带来了较大困难,本文旨在教学配置docker代理,先决安装软件如下: * ss-local / clash等类似代理软件 * Proxychains Proxychains代理软件安装配置及基本使用在Ubuntu中执行Liunx命令,经常会遇到有一部分命令需要走代理,一部分命令则不需要走代理,而Proxychains这个工具则可达到以上需求: # 不需要走代理的命令
curl www.google.com # 需要走代理的命令
proxychains curl www.google.com # 需要一个全走代理的终端
proxychains bash Proxychains的安装 # 安装Proxychains
sudo apt install proxychains Proxychains的基本配置 安装完毕后,Proxychains的默认配置地址在:“/etc/proxychains.conf”中,使用vi查看配置文件: # 查看proxychains配置文件
sudo vi /e

Docker配置教程
Ghost官方镜像文档位于https://hub.docker.com/_/ghost
在home目录下新建stack.yml文件,填入Ghost官方镜像提供的配置内容,并修改一行内容即可:
version: '3.1'
services:
ghost:
image: ghost:5-alpine
restart: always
ports:
- 8080:2368
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: example
database__connection__database: ghost
# this url value is just an example, and is likely wrong for your environment!
# 如果不是本地部署,而是需要远程访问配置域名的话,一定要将这里的url修改为对应域名,否则在部分页面如编辑器中会重定向到该域名,出现报错!!!
url: http://localhost:8080
# contrary to the default mentioned in the linked documentation, this image defaults to NODE_ENV=production (so development mode needs to be explicitly specified if desired)
#NODE_ENV: development
volumes:
- ghost:/var/lib/ghost/content
db:
image: mysql:8.0
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
volumes:
- db:/var/lib/mysql
volumes:
ghost:
db:
执行命令“docker-compose -f stack.yml up”,等待所有镜像下载完毕,数据库启动完毕后,进入“配置域名/ghost”如“localhost:8080/ghost”跟随向导即可完成配置。
💡
在首次执行命令的过程中,可能出现数次至20多次的数据库连接失败报错信息,请耐心等待数据库启动,不要因为出现报错就ctrl+c停止了,最终数据库会启动成功,报错信息就会消失