docker run -d -p 8081:80 nginxImageID
瀏覽器訪問:host-ip:8081nginx
2個日誌: access.log,記錄每一個HTTP請求信息 error.log,記錄Nginx運行中的錯誤,用於排錯 配置文件:nginx.conf docker exec -ti containerID sh # find . -name "nginx.conf" ./etc/nginx/nginx.conf # ls -l /etc/nginx total 32 drwxr-xr-x. 2 root root 25 Dec 16 17:29 conf.d -rw-r--r--. 1 root root 1007 Dec 9 15:34 fastcgi_params -rw-r--r--. 1 root root 2837 Dec 9 15:34 koi-utf -rw-r--r--. 1 root root 2223 Dec 9 15:34 koi-win -rw-r--r--. 1 root root 3957 Dec 9 15:34 mime.types -rw-r--r--. 1 root root 643 Dec 9 15:34 nginx.conf -rw-r--r--. 1 root root 636 Dec 9 15:34 scgi_params -rw-r--r--. 1 root root 664 Dec 9 15:34 uwsgi_params -rw-r--r--. 1 root root 3610 Dec 9 15:34 win-utf # find . -name "access.log" ./var/log/nginx/access.log # ls -l /var/log/nginx/ total 0 lrwxrwxrwx. 1 root root 11 Dec 16 17:29 access.log -> /dev/stdout lrwxrwxrwx. 1 root root 11 Dec 16 17:29 error.log -> /dev/stderr
掛載共享目錄: /etc/nginx /var/log/nginxdocker