自用服务器初始docker环境配置

bbr+fq&swap脚本

wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh

安装docker和docker compose

wget -qO- get.docker.com | bash
systemctl enable docker
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

创建docker网络

docker network create dockernetwork

创建并绑定docker网络是为了让npm在内网反代docker容器,而不需要保留docker容器到公网,以提升安全性。

安装NPM

mkdir docker docker/npm
cd docker/npm
vim docker-compose.yml
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      # These ports are in format <host-port>:<container-port>
      - '80:80' # Public HTTP Port
      - '443:443' # Public HTTPS Port
      - '81:81' # Admin Web Port
      # Add any other Stream port you want to expose
      # - '21:21' # FTP

    # Uncomment the next line if you uncomment anything in the section
    # environment:
      # Uncomment this if you want to change the location of
      # the SQLite DB file within the container
      # DB_SQLITE_FILE: "/data/database.sqlite"

      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'

    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt

networks:
  default:
    external: true
    name: dockernetwork
docker compose up -d

默认管理员用户,登录ip:81后修改:

Email:    admin@example.com
Password: changeme

安装watchtower

mkdir docker/watchtower
cd docker/watchtower
vim docker-compose.yml
services:
  watchtower:
    image: containrrr/watchtower
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
docker compose up -d

如果您需要排除某些容器,请将com.centurylinklabs.watchtower.enable标签设置为false。为清楚起见,应
在您希望忽略的容器上设置此标签,而不是在 watchtower 上设置。

LABEL com.centurylinklabs.watchtower.enable="false"
docker run -d --label=com.centurylinklabs.watchtower.enable=false someimage
services:
  someimage:
    container_name: someimage
    labels:
      - "com.centurylinklabs.watchtower.enable=false"

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!无需注册,过短或乱码评论会被屏蔽。
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容