DockerFile的編寫
阿新 • • 發佈:2018-04-23
ja
1、制作nginx服務器的dockerfile
# This is my first Dockfile # version 1.0 # Author:fish FROM centos MAINTAINER fish.chen ADD nginx-1.9.3.tar.gz /usr/local/src ADD pcre-8.38.tar.gz /usr/local/src RUN yum -y install wget gcc gcc-c++ make openssl-devel bzip2 RUN useradd -s /sbin/nologin -M www WORKDIR /usr/local/src/nginx-1.9.3 RUN ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.38 && make && make install RUN echo "daemon off;" >>/usr/local/nginx/conf/nginx.conf # VOLUME ENV PATH /usr/local/nginx/sbin:$PATH EXPOSE 80 CMD ["ngxin"]
編譯nginx
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz wget http://nginx.org/download/nginx-1.9.3.tar.gz useradd -s /sbin/nologin -M www yum install wget gcc gcc-c++ make openssl-devel bzip2 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre2-10.21 ./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --with-pcre=/usr/local/src/pcre-8.38 /usr/local/nginx/sbin/nginx echo "daemon off;" >>/usr/local/nginx/conf/nginx.conf
2、制作stress服務器的dockerfile
# This is my first Dockfile # version 1.0 # Author:fish FROM centos MAINTAINER fish ADD epel.repo /etc/yum.repos.d/ RUN yum install -y stress && yum clean all ENTRYPOINT ["stress"]
DockerFile的編寫