1、设置防火墙

firewall-cmd --zone=public --add-port=端口/tcp --permanent

2、安装存储库(本文所用的系统为Centos7.6)

  • 安装yum-utils包(提供yum-config-manager 实用程序)并设置存储库:
yum install -y yum-utils

yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo                                                                                                                                                                                                                                                                                                                      

3、安装Docker引擎

  • 安装 Docker Engine、containerd 和 Docker Compose:
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  • docker管理
systemctl start docker  #启动容器
systemctl enable docker #开机自启
systemctl status docker #查看状态
docker --version #查看docker版本

4、安装Docker Compose

  • 下载&安装
curl -L "https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  • 给执行权限
chmod +x /usr/local/bin/docker-compose
  • 创建软链
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
  • 查看docker-compose版本
docker-compose version

5、部署NginxProxyManager服务

  • 在docker目录下创建一个npm文件夹
  • 在npm文件夹下创建一个的docker-compose.yml文件
version: "3"
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
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: "npm"
      DB_MYSQL_PASSWORD: "npm"
      DB_MYSQL_NAME: "npm"
      # Uncomment this if IPv6 is not enabled on your host
      # DISABLE_IPV6: 'true'
    volumes:
      - ./data:/data
      - ./letsencrypt:/etc/letsencrypt
    depends_on:
      - db

  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: 'npm'
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: 'npm'
      MYSQL_PASSWORD: 'npm'
    volumes:
      - ./data/mysql:/var/lib/mysql
  • 在当前目录运行以下命令安装此服务
docker-compose up -d
  • 初始账号&密码
Email:    admin@example.com

Password: changeme
  • 证书保存路径
/var/lib/docker/npm/letsencrypt/archive

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注