# docker_Nginx筆記 - 建立一個目錄叫data並進去 ``` mkdir data cd data ``` - 建立4樣東西  ### Dockerfile ``` FROM nginx COPY index.html /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf COPY /member_test /member_test/ RUN apt-get update RUN apt-get install -y vim python python-pip curl RUN pip install -r /member_test/requirements.txt RUN cd /tmp RUN curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh RUN sh -c '/bin/echo -e "\nyes\n\nyes" | sh Miniconda3-latest-Linux-x86_64.sh' ``` ### Docker-compose.yml 組合了docker build 與 docker run 的yml檔 ``` version: "3.7" services: nginx: build: context: . dockerfile: Dockerfile args: tag list: kenson_nginx restart: always image: kenson_nginx ports: - "7777:80" container_name: kenson ``` ### index.html ``` <h1> Nginx index </h1> ``` ### nginx.conf ``` server{ listen 80 default_server; listen [::]:80 default_server; server_name lou.com; root /usr/share/nginx/html; index index.html; charset utf-8; access_log /var/log/nginx/access_log; error_log /var/log/nginx/error_log; } ``` - 在當前目錄下執行docker-compose ``` docker-compose up -d ``` - 服務完成起來以後就可以看到  - docker images (已build kenson_nginx)  - docker run nginx( name:kenson)  - 開啟網頁 url:7777 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up