zoukankan      html  css  js  c++  java
  • Docker 构建镜像

    手动构建nginx
    docker ps |awk '{print $1}'|sed -n '2,$'p |xargs docker stop ;
    docker ps -a|awk '{print $1}'|sed -n '2,$'p|xargs docker rm ;

    docker run -it --name ngx-img centos
    yum -y install wget gcc gcc-c++ make openssl-devel ntp

    cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    ntpdate cn.ntp.org.cn


    wget http://nginx.org/download/nginx-1.12.0.tar.gz
    wget --no-check-certificate https://ftp.pcre.org/pub/pcre/pcre-8.39.tar.gz

    useradd -s /sbin/nolog -M www
    ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.39

    make && make install

    /usr/local/nginx/sbin/nginx

    vi /etc/rc.local /usr/local/nginx/sbin/nginx #这条没用
    vi /usr/local/nginx/conf/nginx.conf daemon off;

    docker run -d -p 90:80 lijie/my-ngx:20170415v3 /usr/local/nginx/sbin/nginx
    然后可以通过网页访问nginx的页面。

    编写Dockerfile

    # This is My Dockerfile
    # Version 1.0
    # Author LiJie

    #Base images
    From centos

    #MAINTAINER
    MAINTAINER Alex Li

    #ADD
    ADD pcre-8.39.tar.gz /usr/local/src
    ADD nginx-1.12.0.tar.gz /usr/local/src

    #RUN
    RUN yum -y install wget gcc gcc-c++ make openssl-devel ntp
    RUN useradd -s /sbin/noloing -M www

    #WORKDIR
    WORKDIR /usr/local/src/nginx-1.12.0

    RUN ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.39 && make && make install

    RUN echo "daemon off;" >> /usr/local/nginx/conf/nginx.conf

    ENV PATH /usr/local/nginx/sbin:$PATH
    EXPOSE 80

    CMD ["nginx"]


    docker build -t nginx-file:v1 /opt/docker-file/nginx

    docker run -d -p 9090:80 nginx-file:v1

  • 相关阅读:
    【Jsoi2010】连通数
    【CQOI2009】中位数图
    【POJ 1151】 Altlantis
    【2017省中集训】 香港记者
    【AHOI2009】中国象棋
    【SCOI 2009】 Windy数
    【HDU 4722】 Good Numbers
    【HDU 2089】 不要62
    BZOJ3129 SDOI2013方程(容斥原理+扩展lucas)
    BZOJ1042 HAOI2008硬币购物(任意模数NTT+多项式求逆+生成函数/容斥原理+动态规划)
  • 原文地址:https://www.cnblogs.com/python-study/p/6716544.html
Copyright © 2011-2022 走看看