自建Halo博客搭建-Docker
date
May 15, 2022
slug
newservice-docker-halo
status
Published
summary
新服务-
tags
service
type
Post
URL
Summary
export DOCKER_PROJ=halo
mkdir -p /data/$DOCKER_PROJ; cd /data/$DOCKER_PROJ
Docker搭建
wget https://dl.halo.run/config/application-template.yaml -O application.yaml
# 修改application.yaml
# 改 username & password - 也可以不改
docker run -it -d \
--name=$DOCKER_PROJ \
-p 18110:8090 \
-e TZ=Asia/Hong_Kong \
-v $(pwd)/data_docker:/root/.halo \
--restart unless-stopped \
halohub/halo:latest
sleep 1s; docker logs -f $DOCKER_PROJ
Docker-compose搭建
cat > docker-compose.yml <<EOF
version: "3"
services:
halo:
image: halohub/halo:latest
container_name: halo
restart: unless-stopped
volumes:
- ./data:/root/.halo
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "18110:8090"
environment:
- SERVER_PORT=8090
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.h2.Driver
- SPRING_DATASOURCE_URL=jdbc:h2:file:~/.halo/db/halo
- SPRING_DATASOURCE_USERNAME=admin-change-it!!!
- SPRING_DATASOURCE_PASSWORD=kjdjOik-change-it!!!
- HALO_ADMIN_PATH=admin
- HALO_CACHE=memory
EOF
docker-compose up
docker-compose down; docker-compose up -d; sleep 1s; docker-compose logs -f