默认读取当前目录下的Dockerfile文件。bocker build命令最后必须加一个点.
docker build -t php72:v1 .
Dockerfile
FROM php:7.2-fpm
MAINTAINER Wu Hanqing <554553400@qq.com>
#更换debian9 stretch 软件源
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && \
echo "deb http://mirrors.ustc.edu.cn/debian stretch main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://mirrors.ustc.edu.cn/debian-security/ stretch/updates main non-free contrib" >> /etc/apt/sources.list && \
echo "deb http://mirrors.ustc.edu.cn/debian stretch-updates main contrib non-free" >> /etc/apt/sources.list
RUN apt-get update
#安装GD扩展库
RUN apt-get install -y libpng-dev libjpeg-dev libfreetype6-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/freetype2 --with-png-dir=/usr/include --with-jpeg-dir=/usr/include
RUN docker-php-ext-install gd
#安装mysql扩展
#RUN docker-php-ext-install mysql
RUN docker-php-ext-install pdo_mysql
#安装ZIP扩展
#RUN docker-php-ext-install zip
#安装intel扩展
#RUN apt-get install -y libicu-dev
#RUN docker-php-ext-install intl
EXPOSE 9000
你必须知道的Dockerfile https://www.cnblogs.com/edisonchou/p/dockerfile_inside_introduction.html
docker使用Dockerfile构建镜像的方法 https://www.jb51.net/article/151859.htm
docker run 和 docker exec 的差异 https://www.cnblogs.com/miracle-luna/p/11111852.html