• docker构建nginx


    1.创建一个保存DOckerfile的目录

    mkdir /data/nginx

    2.编辑Dockerfile配置文件

    vim /data/Dockerfile

    From centos
    RUN rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
    RUN yum install -y vim wget tree lrzsz gcc gcc-c++ automake pcre pcre-devel zlib zlib-devel openssl openssl-devel iproute net-tools iotop
    ADD nginx-1.8.1.tar.gz /tmp/
    RUN cd /tmp/nginx-1.8.1 && ./configure –prefix=/usr/local/nginx && make && make install
    RUN cd /usr/local/nginx/
    ADD nginx.conf /usr/local/nginx/conf/nginx.conf
    RUN useradd nginx -s /sbin/nologin
    RUN ln -sv /usr/local/nginx/sbin/nginx /usr/sbin/nginx
    RUN echo “test nginx page” > /usr/local/nginx/html/index.html
    EXPOSE 80 443
    CMD [“nginx”]

    3.开始构建

    cp /usr/local/nginx/conf/nginx.conf .
    cp /usr/local/src/nginx-1.8.1.tar.gz .
    docker build -t leishujun/nginx:v4 /data/nginx/

    至此,编译安装的nginx就构建完成

    另外还可以yum构建Nginx,Dockerfile内容如下:

    from centos
    run rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
    run yum install nginx -y
    run echo “daemon off;” >> /etc/nginx/nginx.conf
    run echo “test nginx page” > /usr/share/nginx/html/index.html
    expose 80
    expose 443
    cmd [“nginx”,”ls”]

  • 相关阅读:
    Type Safety and Type Inference
    LEARN SWIFT
    swift 类型备份
    Swift
    associatedtype关联类型
    深入理解 Swift 派发机制
    Swift中self和Self
    Postfix Self Expression
    CGContext与上下文
    eeee
  • 原文地址:https://www.cnblogs.com/dengbingbing/p/10502323.html
Copyright © 2020-2023  润新知