B1. Install Docker Engine
Ubuntu https://docs.docker.com/engine/install/ubuntu/
Câu lệnh cài đặt nhanh Docker

curl -fsSL https://get.docker.com -o get-docker.sh
Chạy docker
sudo sh get-docker.sh
Lưu ý cấp quyền chạy User
sudo usermod -aG docker $USER
Sau đó bạn hãy logout và login tiến hành bước tiếp theo
B2. Running the App

Tạo docker-compose.yml file:
yml có nội dung như sau
version: '3.8'
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
sau đó hãy chạy lênh sau để chạy file:
docker compose up -d
Sử dụng cơ sở dữ liệu MySQL / MariaDB
Nếu bạn chọn cấu hình MySQL, bạn sẽ phải tự cung cấp máy chủ cơ sở dữ liệu. Bạn cũng có thể sử dụng MariaDB. Sau đây là các phiên bản được hỗ trợ tối thiểu:
- MySQL v5.7.8+
- MariaDB v10.2.7+
Bạn cũng có thể dễ dàng sử dụng một container docker khác cho cơ sở dữ liệu của mình và liên kết nó như một phần của ngăn xếp docker, đó chính là mục đích mà các ví dụ sau đây sẽ sử dụng.
Sau đây là ví dụ về giao diện của bạn docker-compose.yml khi sử dụng vùng chứa MariaDB:
yml
version: '3.8'
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:
# Mysql/Maria connection parameters:
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'
MARIADB_AUTO_UPGRADE: '1'
volumes:
- ./mysql:/var/lib/mysql
WARNING
Xin lưu ý rằng DB_MYSQL_* các biến môi trường sẽ được ưu tiên hơn DB_SQLITE_*các biến. Vì vậy, nếu bạn giữ các biến MySQL, bạn sẽ không thể sử dụng SQLite.
