码头工人入门与应用实战之Dockerfile

  


1。Dockerfile格式

码头工人入门与应用实战之Dockerfile


2。Dockerfile指令

码头工人入门与应用实战之Dockerfile


3。构建镜像

码头工人入门与应用实战之Dockerfile


4。构建Nginx、PHP Tomcat基础镜像

前提:上传文件dockerfile . zip和wordpress-4.9.4-zh_CN.tar。广州

 [root@localhost first_stage] # sed - Dockerfile-nginx s/1.12.2/1.15.5/g
  [root@localhost first_stage] #猫Dockerfile-nginx
  从centos: 7
  维护者www.dengaosky.com
  运行yum安装- y gcc gcc-c + + \
  openssl-devel pcre-devel gd-devel \
  iproute net-tools telnet wget卷曲,,\
  百胜清洗所有的,,\
  rm射频/var/cache/yum/*
  wget运行http://nginx.org/download/nginx-1.15.5.tar.gz,,\
  焦油zxf nginx-1.15.5.tar。广州,,\
  cd nginx-1.15.5,,\
  ./configure——prefix=/usr/地方/nginx \
  ——with-http_ssl_module \
  ——with-http_stub_status_module,,\
  让- j 4,,制作安装,,\
  rm射频/usr/local/nginx/html/*,,\
  回声“ok”在祝辞/usr/local/nginx/html/status.html,,\
  cd/,,rm射频nginx-1.15.5 *,,\
  ln科幻/usr/share/zoneinfo/Asia/Shanghai/etc/localtime
  
  ENV路径路径:美元/usr/地方/nginx/sbin
  复制nginx。参看/usr/local/nginx/conf/nginx.conf
  WORKDIR/usr/local/nginx
  80年公开
  CMD [" nginx”、“g”,“守护进程;”
  [root@localhost first_stage] #码头工人建造- t nginx: v1 - f Dockerfile-nginx。
  [root@localhost first_stage] #码头工人图像
  标签影像ID创建存储库的大小
  nginx v1 d25e10f6dc2f 3分钟前369 mb
  centos 7 9 f38484d220f 4个月前202 mb
  [root@localhost first_stage] # 

构建PHP基础镜像:

[root@localhost first_stage] #猫Dockerfile-php   从centos: 7   维护者www.dengaosky.com   运行yum安装epel-release - y,和\   yum安装- y gcc gcc-c + +使gd-devel libxml2-devel \   libcurl-devel libjpeg-devel libpng-devel openssl-devel \   libmcrypt-devel libxslt-devel libtidy-devel autoconf \   iproute net-tools telnet wget卷曲,,\   百胜清洗所有的,,\   rm射频/var/cache/yum/*      wget运行http://docs.php.net/distributions/php-5.6.36.tar.gz,,\   焦油zxf php-5.6.36.tar。广州,,\   cd php-5.6.36,,\   ./configure——prefix=/usr/地方/php \   ——with-config-file-path=/usr/地方/php/等等\   ——enable-fpm enable-opcache \   ——使用mysql——with-mysqli——with-pdo-mysql \   ——使用openssl with-zlib——使用curl——与gd \   ——with-jpeg-dir with-png-dir——with-freetype-dir \   ——enable-mbstring——with-mcrypt——enable-hash,,\   让- j 4,,制作安装,,\   cp php。ini-production/usr/local/php/etc/php.ini,,\   cp sapi/fpm/php-fpm。参看/usr/local/php/etc/php-fpm.相依,,\   sed -/usr/local/php/etc/php-fpm.“90 \ daemonize=不”相依,,\   mkdir/usr/local/php/log,,\   cd/,,rm射频php *,,\   ln科幻/usr/share/zoneinfo/Asia/Shanghai/etc/localtime      ENV路径路径:美元/usr/地方/php/sbin   复制php。ini/usr/local/php/etc/php-fpm副本。参看/usr/local/php/etc/WORKDIR/usr/local/php   9000年公开   CMD (“php-fpm”)   [root@localhost first_stage] #码头工人构建php - t: v1 - f Dockerfile-php。   [root@localhost first_stage] #码头工人图像   标签影像ID创建存储库的大小   php v1 402 fe17abd8f 4秒前522 mb   nginx v1 d25e10f6dc2f 15分钟前369 mb   centos 7 9 f38484d220f 4个月前202 mb   [root@localhost first_stage] #

构建Tomcat基础镜像:

[root@localhost first_stage] # sed - Dockerfile-tomcat“s/8.0.52/8.0.46/g”   [root@localhost first_stage] #猫Dockerfile-tomcat   从centos: 7   维护者www.dengaosky.com      ENV VERSION=8.0.46      运行yum安装java-1.8.0-openjdk wget curl解压iproute net-tools - y,,\   百胜清洗所有的,,\   rm射频/var/cache/yum/*      #运行wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v {VERSION}/bin/apache tomcat - {VERSION} gz和,\   wget运行http://archive.apache.org/dist/tomcat/tomcat-8/v {VERSION}/bin/apache tomcat - {VERSION} gz和,\   焦油zxf apache tomcat - {VERSION} . tar美元。广州,,\   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

码头工人入门与应用实战之Dockerfile