使用Dockerfile文件创建镜像

回复 收藏
Dockerfile问题如下:
FROM lnmp_centos
MAINTAINER chengyue chengyue@chengyue.com
RUN  yum install -y net-tools pcre-devel.x86_64 gcc zlib zlib-devel make openssl-devel wget
RUN  echo `pwd`
RUN  cd /root/
RUN  tar -zxvf nginx-1.4.7.tar.gz
RUN  mkdir -p /usr/local/nginx
RUN  cd nginx-1.4.7 && ./configure --prefix=/usr/local/nginx --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module  --with-pcre && make &&  make install
RUN  rm -fv /usr/local/nginx/conf/nginx.conf
RUN  cp nginx-1.4.7/conf/nginx.conf /usr/local/nginx/conf/nginx.conf
EXPOSE 80
# CMD /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
RUN cd /root/
RUN yum install -y compat-libstdc++-33.x86_64
ADD ./mysql-5.1.40-linux-x86_64-glibc23.tar.gz /root/
RUN tar -zxvf mysql-5.1.40-linux-x86_64-glibc23.tar.gz
RUN mv mysql-5.1.40-linux-x86_64-glibc23 /usr/local/mysql
RUN useradd -s /sbin/nologin/ mysql
RUN cd /usr/local/mysql
RUN mkdir -p /var/mysqldata
RUN chmod -R mysql:mysql /var/mysqldata
RUN cd /usr/local/mysql/bin
RUN ./scripts/mysql_install_db --user=mysql  --datadir=/var/mysqldata
RUN cp ../support-files/my-large.cnf  /etc/my.cnf
RUN cp ../support-files/mysql.server /etc/init.d/mysqld
RUN chmod 755 /etc/init.d/mysqld
RUN echo "datadir=/var/mysqldata basedir=/usr/local/mysql" >> /etc/my.cnf
RUN wget http://cn2.php.net/get/php-5.5.36.tar.gz
RUN tar -zxvf php-5.5.36.tar.gz
RUN yum install -y libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64  epel-release.noarch libmcrypt.x86_64 libmcrypt-devel.x86_64
RUN wget
RUN cd php-5.5.36
RUN useradd -s /sbin/nologin php-fpm
RUN ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --enable-zend-multibyte --disable-ipv6 --with-pear --with-curl --with-openss
RUN cp php.ini-production /usr/local/php/etc/php.ini
RUN cp sapi/fpm/php-fpm /etc/init.d/php-fpm
RUN chmod 755 /etc/init.d/php-fpm

执行的结果错误:
mysql-5.1.40-linux-x86_64-glibc23/lib/libmysqlclient.so
mysql-5.1.40-linux-x86_64-glibc23/lib/libmysqlclient.la
mysql-5.1.40-linux-x86_64-glibc23/lib/libmysqlclient.a

gzip: stdin: unexpected end of file
tar: Unexpected EOF in archive
tar: Unexpected EOF in archive
tar: Error is not recoverable: exiting now
The command '/bin/sh -c tar -zxvf mysql-5.1.40-linux-x86_64-glibc23.tar.gz' returned a non-zero code: 2
提示的信息是这个压缩包有问题,但是在宿主机内解压并没有为问题呀。
对与,/root/:/root/是将宿主的/root/和容器的/root/互联
2016-06-02 21:41 举报
已邀请:
0

阿铭 管理员

赞同来自:

换个其他版本的试试

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: