Docker 重要软件安装和使用记录

2 minute

Install

 1# op1. apt
 2apt install docker.io -y && apt install docker-compose -y
 3
 4# op2. yum
 5# yum install -y yum-utils device-mapper-persistent-data lvm2
 6yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
 7yum install docker-ce
 8curl -L "https://github.com/docker/compose/releases/download/v2.2.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
 9chmod +x /usr/local/bin/docker-compose
10ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
1systemctl start docker && systemctl enable docker

Mirror

EDIT: /etc/docker/daemon.json

1{
2  "registry-mirrors": [
3          "https://docker.mirrors.ustc.edu.cn",
4          "http://hub-mirror.c.163.com",
5          "https://registry.docker-cn.com"
6  ]
7}
1systemctl restart docker

Webdav

 1version: "3"
 2services:
 3  webdav:
 4    image: bytemark/webdav
 5    restart: unless-stopped
 6    ports:
 7      - "8099:80"
 8    environment:
 9      AUTH_TYPE: Basic
10      USERNAME: ${WEBDAV_USERNAME}
11      PASSWORD: ${WEBDAV_PASSWORD}
12    volumes:
13      - ./data/:/var/lib/dav

Alist

 1version: "3"
 2services:
 3    alist:
 4        image: 'xhofe/alist:latest'
 5        container_name: alist
 6        volumes:
 7            - './data:/opt/alist/data'
 8        ports:
 9            - '${ALIST_PORT}:5244'
10        environment:
11            - PUID=0
12            - PGID=0
13            - UMASK=022
14        restart: always

IT-Tools

1docker run -d --name it-tools --restart unless-stopped -p ${IT_TOOLS_PORT}:80 corentinth/it-tools:latest

Kafka-Zookeeper

 1version: "3"
 2services:
 3  zoo1:
 4    image: zookeeper:3.4.9
 5    hostname: zoo1
 6    ports:
 7      - "${ZOOKEEPER_PORT}:2181"
 8    environment:
 9      ZOO_MY_ID: 1
10      ZOO_PORT: 2181
11      ZOO_SERVERS: server.1=zoo1:2888:3888
12    volumes:
13      - ./zk-single-kafka-single/zoo1/data:/data
14      - ./zk-single-kafka-single/zoo1/datalog:/datalog
15
16  kafka1:
17    image: confluentinc/cp-kafka:5.3.1
18    hostname: kafka1
19    ports:
20      - "${KAFKA_PORT}:9092"
21    environment:
22      KAFKA_ADVERTISED_LISTENERS: LISTENER_DOCKER_INTERNAL://kafka1:19092,LISTENER_DOCKER_EXTERNAL://${DOCKER_HOST_IP:-127.0.0.1}:9092
23      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: LISTENER_DOCKER_INTERNAL:PLAINTEXT,LISTENER_DOCKER_EXTERNAL:PLAINTEXT
24      KAFKA_INTER_BROKER_LISTENER_NAME: LISTENER_DOCKER_INTERNAL
25      KAFKA_ZOOKEEPER_CONNECT: "zoo1:2181"
26      KAFKA_BROKER_ID: 1
27      KAFKA_LOG4J_LOGGERS: "kafka.controller=INFO,kafka.producer.async.DefaultEventHandler=INFO,state.change.logger=INFO"
28      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
29
30    volumes:
31      - ./zk-single-kafka-single/kafka1/data:/var/lib/kafka/data
32    depends_on:
33      - zoo1

FreshRSS

 1version: "3"
 2services:
 3  freshrss:
 4    image: freshrss/freshrss:latest
 5    container_name: freshrss
 6    restart: unless-stopped
 7    logging:
 8      options:
 9        max-size: 10m
10    volumes:
11      - ./data:/var/www/FreshRSS/data
12      - ./extensions:/var/www/FreshRSS/extensions
13    ports:
14      - "${FRESHRSS_PORT}:80"
15    environment:
16      TZ: "Asia/Shanghai"
17      CRON_MIN: "3,33"

MySQL

 1version: "3"
 2services:
 3  mysql:
 4    image: mysql:8
 5    container_name: mysql
 6    restart: unless-stopped
 7    ports:
 8      - ${DB_PORT}:3306
 9    environment:
10      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
11      - MYSQL_DATABASE=${DB_DATABASE}
12      - MYSQL_USER=${DB_USERNAME}
13      - MYSQL_PASSWORD=${DB_PASSWORD}
14    volumes:
15      - ./data:/var/lib/mysql
16      - ./conf:/etc/mysql/conf.d

PostgreSQL

 1version: "3"
 2services:
 3  postgres:
 4    image: postgres:15
 5    ports:
 6      - ${PORT}:5432
 7    volumes:
 8      - ./data:/var/lib/postgresql/data
 9    environment:
10      - POSTGRES_USER=${POSTGRES_USER}
11      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
12      - POSTGRES_DB=${POSTGRES_DB}

RSSHub

1wget https://raw.githubusercontent.com/DIYgod/RSSHub/master/docker-compose.yml

Redis

 1version: "3"
 2services:
 3  redis:
 4    image: redis:alpine
 5    container_name: redis
 6    ports:
 7      - "${REDIS_PORT}:6379"
 8    restart: always
 9    command: "redis-server --requirepass ${REDIS_PASSWORD}"
10    # command: "redis-server"
11    volumes:
12      - ./data:/data

FakaShop

 1version: "3"
 2services:
 3  faka:
 4    image: ghcr.io/apocalypsor/dujiaoka:latest
 5    container_name: faka
 6    environment:
 7      - INSTALL=${INSTALL}
 8    volumes:
 9      - ./.env:/dujiaoka/.env
10      - ./uploads:/dujiaoka/public/uploads
11      - ./storage:/dujiaoka/storage
12    ports:
13      - ${PORT}:80
14    restart: always
15    depends_on:
16      - db
17      - redis
18  db:
19    image: mariadb:focal
20    container_name: faka-data
21    restart: always
22    environment:
23      - MYSQL_ROOT_PASSWORD=${DB_ROOT_PASSWORD}
24      - MYSQL_DATABASE=${DB_DATABASE}
25      - MYSQL_USER=${DB_USERNAME}
26      - MYSQL_PASSWORD=${DB_PASSWORD}
27    volumes:
28      - ./data:/var/lib/mysql
29  redis:
30    image: redis:alpine
31    container_name: faka-redis
32    ports:
33      - "${REDIS_PORT}:6379"
34    restart: always
35    command: "redis-server --requirepass ${REDIS_PASSWORD}"
36    volumes:
37      - ./redis:/data
 1# .env
 2INSTALL=false # first time -> true
 3PORT=80
 4APP_NAME=APP_NAME
 5APP_ENV=local
 6APP_KEY=APP_KEY
 7APP_DEBUG=false
 8APP_URL=APP_URL
 9ADMIN_HTTPS=false
10ADMIN_ROUTE_PREFIX=/admin
11
12DB_CONNECTION=mysql
13DB_HOST=db
14DB_PORT=3306
15DB_ROOT_PASSWORD=DB_ROOT_PASSWORD
16DB_DATABASE=dujiaoka
17DB_USERNAME=dujiaoka
18DB_PASSWORD=DB_PASSWORD
19
20REDIS_HOST=redis
21REDIS_PASSWORD=REDIS_PASSWORD
22REDIS_PORT=6379
23CACHE_DRIVER=redis
24QUEUE_CONNECTION=redis
25
26LOG_CHANNEL=stack
27BROADCAST_DRIVER=log
28SESSION_DRIVER=file
29SESSION_LIFETIME=120
30
31# zh_CN zh_TW en
32DUJIAO_ADMIN_LANGUAGE=zh_CN