pi上用的Docker容器记录
纯笔记,哪天硬盘挂了,方便爷们重建。
配置http proxy
# 创建目录
mkdir /etc/systemd/system/docker.service.d
# 创建文件写入 /etc/systemd/system/docker.service.d/http-proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.0.237:3129"
Environment="HTTPS_PROXY=http://192.168.0.237:3129"
# 重启服务
systemctl daemon-reload
systemctl restart docker
# 查看配置生效
systemctl show docker --property Environment
Environment=HTTP_PROXY=http://pi.lan:3129 HTTPS_PROXY=http://pi.lan:3129
portainer
docker volume create portainer_data # 创建数据目录/var/lib/docker/volumes
# 新,支持自签名证书
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
# 老
docker run -d -p 9000:9000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
gitea
docker volume create gitea_data
version: "3"
#networks:
# gitea:
# external: false
services:
server:
image: gitea/gitea
container_name: gitea
environment:
- USER_UID=1000
- USER_GID=1000
restart: always
# networks:
# - gitea
network_mode: bridge
volumes:
- gitea_data:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
ports:
- "3000:3000"
- "2222:22"
volumes:
gitea_data:
external: true
name: gitea_data
docker-compose up -d
mysql
docker volume create mysql_data
docker run --name mysql -p 3306:3306 -v mysql_data:/var/lib/mysql --restart=always -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mysql:lts
为Ghost创建数据库,用户名和密码。
docker exec -it mysql /bin/sh
mysql -u root -p
> CREATE DATABASE Ghost CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
> CREATE USER 'ghost'@'%' IDENTIFIED BY 'password';
> GRANT ALL PRIVILEGES ON Ghost.* TO 'ghost'@'%';
> FLUSH PRIVILEGES;
Ghost
docker volume create ghost_data
version: '3.1'
services:
ghost:
container_name: ghost
image: ghost:latest
restart: always
network_mode: bridge
ports:
- "2368:2368"
environment:
# see https://ghost.org/docs/config/#configuration-options
database__client: mysql
database__connection__host: host.docker.internal
database__connection__user: ghost
database__connection__password: passowrd
database__connection__database: Ghost
# this url value is just an example, and is likely wrong for your environment!
url: https://blog.blobolb.xyz
# 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
#HTTP_PROXY: http://host.docker.internal:3129
#HTTPS_PROXY: http://host.docker.internal:3129
volumes:
- ghost_data:/var/lib/ghost/content
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
ghost_data:
external: true
name: ghost_data
postgres
docker volume create postgres_data
services:
postgres:
image: postgres:16-alpine
container_name: bitmagnet-postgres
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
restart: always
network_mode: bridge
environment:
- POSTGRES_PASSWORD=postgres
#- POSTGRES_DB=db
- PGUSER=postgres
shm_size: 1g
healthcheck:
test:
- CMD-SHELL
- pg_isready
start_period: 20s
interval: 10s
volumes:
postgres_data:
external: true
name: postgres_data
备份恢复
0 2 * * 6 pg_dump --column-inserts --on-conflict-do-nothing --rows-per-insert=1000 --table=metadata_sources --table=content --table=content_attributes --table=content_collections --table=content_collections_content --table=torrent_sources --table=torrents --table=torrent_files --table=torrent_hints --table=torrent_contents --table=torrent_tags --table=torrents_torrent_sources --table=key_values bitmagnet > /var/lib/postgresql/data/backup.sql
psql -U postgres -h localhost -c "CREATE DATABASE bitmagnet;"
psql -U postgres -h localhost -d bitmagnet -f backup.sql
bitmagnet
services:
bitmagnet:
image: ghcr.io/bitmagnet-io/bitmagnet:latest
container_name: bitmagnet
ports:
# API and WebUI port:
- "3333:3333"
# BitTorrent ports:
#- "3334:3334/tcp"
#- "3334:3334/udp"
restart: unless-stopped
network_mode: bridge
environment:
- POSTGRES_HOST=host.docker.internal
- POSTGRES_PASSWORD=postgres
# - TMDB_API_KEY=your_api_key
#- LOG_LEVEL=debug
- TMDB_ENABLED=false
- DHT_CRAWLER_SCALING_FACTOR=1
command:
- worker
- run
- --keys=http_server
- --keys=queue_server
# disable the next line to run without DHT crawler
#- --keys=dht_crawler
extra_hosts:
- "host.docker.internal:host-gateway"
pihole
version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
network_mode: bridge
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp" # Only required if you are using Pi-hole as your DHCP server
- "8081:80/tcp"
environment:
TZ: 'Asia/Shanghai'
WEBPASSWORD: 'passowrd'
# Volumes store your data between container upgrades
volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
#cap_add:
# - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed
restart: unless-stopped
jackett
docker volume create jackett_data
version: '3'
services:
# 用bitmagnet替代
# Jackett: https://hub.docker.com/r/linuxserver/jackett
jackett:
image: linuxserver/jackett:latest
container_name: jackett
hostname: jackett
network_mode: bridge
restart: always
environment:
- PUID=1026
- PGID=101
- TZ=Asia/Shanghai
- AUTO_UPDATE=true
ports:
- 9117:9117
volumes:
- jackett_data:/config
volumes:
jackett_data:
external: true
name: jackett_data
heimdall
docker volume create heimdall_data
docker run -d \
--name=heimdall \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-p 80:80 \
-p 443:443 \
-v heimdall_data:/config \
--restart unless-stopped \
lscr.io/linuxserver/heimdall:latest
qBittorrent
sudo docker volume create qbittorrent_data
docker run -d \
--name=qbittorrent \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Shanghai \
-e WEBUI_PORT=8080 \
-e TORRENTING_PORT=6881 \
-p 8080:8080 \
-p 6881:6881 \
-p 6881:6881/udp \
-v qbittorrent_data:/config \
-v /home/god/Downloads:/downloads \
--restart unless-stopped \
lscr.io/linuxserver/qbittorrent:latest
cyberchef
sudo docker run -d --name=cyberchef -p 8008:8000 mpepping/cyberchef
azerothcore
# mysql容器创建
# CREATE DATABASE acore_auth;
# CREATE DATABASE acore_world;
# CREATE DATABASE acore_characters;
# CREATE USER 'acore'@'%' IDENTIFIED BY 'acore123';
# GRANT ALL PRIVILEGES ON acore_auth.* TO 'acore'@'%';
# GRANT ALL PRIVILEGES ON acore_world.* TO 'acore'@'%';
# GRANT ALL PRIVILEGES ON acore_characters.* TO 'acore'@'%';
# FLUSH PRIVILEGES;
FROM ubuntu:24.04
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update
RUN apt-get -y install git cmake make gcc g++ clang libssl-dev libbz2-dev libreadline-dev libncurses-dev libboost-all-dev build-essential
RUN mkdir -p /root
COPY mysql-8.4.2.tar.gz /root/
RUN cd /root && tar -xzf mysql-8.4.2.tar.gz && cd mysql-8.4.2 && mkdir build && cd build && cmake .. -DWITHOUT_SERVER=ON -DWITH_SSL=system && make -j2 && make install
RUN rm -f /root/mysql-8.4.2.tar.gz
RUN rm -rf /root/mysql-8.4.2
WORKDIR /root/
COPY azerothcore azerothcore/
RUN cd /root/azerothcore && mkdir build && cd build && cmake ../ -DCMAKE_INSTALL_PREFIX=/root/azeroth-server/ -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DWITH_WARNINGS=1 -DTOOLS_BUILD=all -DSCRIPTS=static -DMODULES=static && make -j4 && make install
COPY start.sh /start.sh
RUN chmod +x /start.sh
CMD ["/start.sh"]
sudo docker build -t acore .
sudo docker run -d --name=azerothcore -p 8085:8085 -p 3724:3724 --add-host=host.docker.internal:host-gateway -v azeroth_data:/root acore:latest sleep infinity
#!/bin/bash
/root/azeroth-server/bin/authserver &
/root/azeroth-server/bin/worldserver &
wait
php
FROM php:8.2-apache
# Install dependencies
RUN apt-get update && apt-get install -y \
libgmp-dev \
libxml2-dev \
libpng-dev \
libjpeg-dev \
libfreetype6-dev \
libzip-dev \
libonig-dev \
libxslt1-dev \
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) \
gmp \
gd \
soap \
mbstring \
pdo \
pdo_mysql \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Enable Apache mod_rewrite
RUN a2enmod rewrite
# Copy application code
COPY WoWSimpleRegistration /var/www/html
# Set permissions for Apache
RUN chown -R www-data:www-data /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
sudo docker build -t php-apache .
sudo docker run -d --name=azeroth_register -p 8565:80 --add-host=host.docker.internal:host-gateway php-apache
fileshare
udo docker run -d --name=fileshare -p 3005:3000 fileshare
clickhouse
sudo docker volume create clickhouse_data
sudo docker run -d --name=clickhouse -e CLICKHOUSE_USER=default -e CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT=1 -e CLICKHOUSE_PASSWORD=xxxxx -p 8123:8123 -v clickhouse_data:/var/lib/clickhouse clickhouse/clickhouse-server
部署失败,翻看docker hub,原因cpu架构不支持
The amd64 image requires support for SSE3 instructions. Virtually all x86 CPUs after 2005 support SSE3.
The arm64 image requires support for the ARMv8.2-A architecture. Most ARM CPUs after 2017 support ARMv8.2-A. A notable exception is Raspberry Pi 4 from 2019 whose CPU only supports ARMv8.0-A.