1、測試環境node
OS version: CentOS Linux release 7.5.1804 (Core)nginx
docker cluster : master 1 + data node 4docker
docker version: 1.13.1centos
2、材料準備測試
1. dockerfile 文件,以下ui
/opt/command/kevin_docker_files/01_nginx/Dockerfile/kevin_nginx_dockerfile.dockerignorespa
# Instruction
FROM centos
# LABLE info
LABEL vendor="itshare" \
version="0.0.1-beta" \
release-date="2018-09-02"
# Dockerfile execute command
RUN mkdir -p /opt/apt/
RUN touch /opt/apt/sources.list
RUN echo "kevin.tian installed nginx" >> /opt/apt/sources.list
# RUN yum update && yum install -y nginx
RUN apt-get update && apt-get install -y nginx
RUN echo "\ndaemon off;" >> /etc/nginx/nginx.conf
# Container startup command
CMD /usr/sbin/nginx
3、實驗步驟code
1. 執行命令,順序以下blog
# 查看本地的Docker鏡像get
root >> docker images
# 執行docker build命令,建立鏡像,
# 注意:build命令結尾有個結束符號 英文句號「.",不要忘記,不然執行會提示錯誤少個參數。
root >> docker build -f "/opt/command/kevin_docker_files/01_nginx/Dockerfile/kevin_nginx_dockerfile.dockerignore" -t "nginx/kevin.tian" .
4、實驗結果