當前環境:centos7.6 (3.10.0-1062.1.1.el7.x86_64)
搜尋nginx映象
docker search nginx
獲取官方的映象
不指定tag
預設是最新版本,本文使用nginx1.17.6
檢視本地映象列表
建立nginx容器外部掛載目錄
建立配置檔案mkdir -p /opt/data/nginx/conf
mkdir -p /opt/data/nginx/conf.d
mkdir -p /opt/data/nginx/html
mkdir -p /opt/data/nginx/logs
在/opt/data/nginx/conf/
目錄下建立nginx.conf
檔案
在/opt/data/nginx/conf.d/
目錄下建立default.conf
檔案
在server
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#error_page 500 502 503 504 /50x.html;
location = /50x.html
}
/opt/data/nginx/html/
目錄下建立index.html
檔案
執行nginx容器
訪問下docker run -d --name nginx -p 80:80 \
-v /opt/data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /opt/data/nginx/logs:/var/log/nginx \
-v /opt/data/nginx/html:/usr/share/nginx/html \
-v /opt/data/nginx/conf.d:/etc/nginx/conf.d \
--restart=always --privileged=true nginx:1.17.6
docke基本使用
介紹docker架構及三個基本概念 映象 容器和倉庫。介紹映象和容器的基本操作 從官方倉庫拉取映象 再建立自己的映象 docker client 客戶端通過命令列或者其他工具使用 docker sdk 與docker守護程序通訊。docker host 主機是乙個物理的或虛擬的機器,用於執行dock...
linux環境下安裝使用wireshark
安裝參考部落格 安裝命令 sudo apt get install wireshark 設定非root使用者許可權 sudo dpkg reconfigure wireshark common 新增wireshark到group中,用vim開啟group sudo vim etc group,然後進...
linux環境下安裝使用git
linux安裝git 安裝命令 sudo apt get install git 配置使用者和郵箱 git config global user.name han xiaotong git config global user.email hanxiaotongtong 163.com hanxt ...