给docker里的php安装gd扩展
docker官方镜像为安装php扩展封装了函数,为开发者提供了很大的便利,以下以Dockerfile的形式演示安装gd扩展的方法,安装gd扩展需要安装几个依赖包,安装依赖包使用系统命令,安装命令根据基础镜像的不同有所不同,以下演示两种使用较多的alpine和debian系统的Dockerfile,Dockerfile中同时包含更换国内开源镜像源的内容。
1、基础镜像 php:7.2-fpm-alpine
Dockerfile如下:
FROM php:7.2-fpm-alpine RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \
&& apk update \
&& apk add libpng-dev freetype-dev libjpeg-turbo-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd EXPOSE 9000
CMD ["php-fpm"]
2、基础镜像 php:7.2-fpm-stretch (debian 9)
Dockerfile如下:
FROM php:7.2-fpm-stretch RUN echo "deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib" > /etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/debian-security stretch/updates main" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/debian-security stretch/updates main" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib" >> /etc/apt/sources.list \
&& rm -f /etc/apt/sources.list.d/* \
&& apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include \
&& docker-php-ext-install -j$(nproc) gd EXPOSE 9000
CMD ["php-fpm"]
给docker里的php安装gd扩展的更多相关文章
- Docker为PHP安装gd扩展
安装扩展库的通常命令 docker-php-ext-install 扩展库名 安装gd库需要特殊照顾,步骤如下 //进入PHP容器 //更新软件源 apt update //安装各种库 apt ins ...
- 已有的PHP安装gd扩展
第一步 安装依赖 1.安装xpm yum install libXpm-devel 2.安装zlib wget http://zlib.net/zlib-1.2.8.tar.gz tar -xzvf ...
- centos系统php5.6版本安装gd扩展库
由于项目需要显示验证码登录系统,所以这里需要开启php的gd扩展 这边提供安装php5.6的yum方法扩展自选.# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fe ...
- centos7下PHP安装gd扩展
第一步: 安装需要用到的库 yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel 第二步: ...
- docker安装GD扩展
apt update #更新软件源 apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev #安装各种库 docker-p ...
- centos7 上为php-fpm安装gd扩展库
转自:https://blog.csdn.net/liyyzz33/article/details/89166110 首先查看自己当前php的版本 php -v PHP 5.6.40 查看yum中是否 ...
- Docker PHP7官方镜像安装Redies扩展
2019独角兽企业重金招聘Python工程师标准>>> 直接RUN docker-php-ext-install redis 失败,google得到: ENV PHPREDIS_VE ...
- docker 简单介绍与安装
主机虚拟化(vmware,visual box等) type-Ⅰ type=Ⅱ 主机虚拟化是隔离最彻底的,但是由于多隔了一个虚拟的操作系统,性能会慢一些. 容器虚拟化(docker等) 隔离没有主机虚 ...
- ubuntu:通过封装验证码类库一步步安装php的gd扩展
我相信很多人的lamp环境都是直接复制一堆参数安装进去的,这里有可能成功,也有可能失败,如果是新手,估计要碰到各种错误,就算安装成功,也未必知道那些参数是干嘛的,反正装进去能用就行. 我当初开始的时候 ...
随机推荐
- JS 内置对象 String对象
JS内置对象 String对象:字符串对象,提供了对字符串进行操作的属性和方法. Array对象:数组对象,提供了数组操作方面的属性和方法. Date对象:日期时间对象,可以获取系统的日期 ...
- 17.splash_case03
# python执行lua脚本 import requests from urllib.parse import quote lua = ''' function main(splash) retur ...
- 最近开始学习python,学习到了关于web的内容。
然而在win10中IIS发布CGI脚本的时候遇到了各种各样的问题. 如ISAPI和CGI限制,权限限制等等,一一的百度解决了,最后又出现了 HTTP 错误 502.2 - Bad Gateway Th ...
- USACO 2013 January Silver Painting the Fence /// oj23695
题目大意: 输入n,k :n次操作 找到覆盖次数在k及以上的段的总长 一开始位置在0 左右活动范围为1-1000000000 接下来n行描述每次操作的步数和方向 Sample Input 6 22 R ...
- Geoserver的跨域问题
使用tomcat访问Geoserver服务的时候,只调服务没问题,但是查询要素属性的时候出现如下“XMLHttpRequest”.“not allowed by Access-Control-Allo ...
- mysql模糊查询特殊字符(\,%和_)处理
/** * sql模糊查询特殊字符(\,%和_)处理 * * @param string $str * @return string */ public static function like_se ...
- OpenGL键盘交互响应事件
GLUT允许我们编写程序,在里面加入键盘输入控制,包括了普通键,和其他特殊键(如F1,UP).在这一章里我们将学习如何去检测哪个键被按下,可以从GLUT里得到些什么信息,和如何处理键盘输入. 处理 ...
- display: -webkit-box; 做个小小试验
最近做个微信项目发现css3在微信内部浏览器中和其他浏览有些区别 做个小小笔记 .job { display: -webkit-box; display: flexbox; -webkit-box-p ...
- .net Cache的用法
HttpContext.Current.Cache 使用方法 .net Cache 怎么使用 /// <summary> /// 简单创建/修改Cache,前提是这个值是字符 ...
- js把时间转化为 ‘2019-07-01’ 格式
将new Date()数据转化为‘2019-07-01’格式 //时间 function formatDate(date) { var y = date.getFullYear(); ; m = m ...