• 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”]

  • 相关阅读:
    MVC知识点01
    MVC知识点02
    ADO.NET基础01
    WinForm,MVC知识点
    C#基础01
    28、对多次使用的RDD进行持久化或Checkpoint
    27、优化数据结构
    26、高性能序列化类库
    25、诊断内存的消耗
    24、Checkpoint原理剖析
  • 原文地址:https://www.cnblogs.com/dengbingbing/p/10502323.html
Copyright © 2020-2023  润新知