[转]Docker php extensions gd
本文转自:https://docs.docker.com/samples/library/php/
How to use this image
Create a Dockerfile
in your PHP project
FROM php:7.2-cli
COPY . /usr/src/myapp
WORKDIR /usr/src/myapp
CMD [ "php", "./your-script.php" ]
Then, run the commands to build and run the Docker image:
$ docker build -t my-php-app .
$ docker run -it --rm --name my-running-app my-php-app
How to install more PHP extensions
Many extensions are already compiled into the image, so it’s worth checking the output of php -m
or php -i
before going through the effort of compiling more.
We provide the helper scripts docker-php-ext-configure
, docker-php-ext-install
, and docker-php-ext-enable
to more easily install PHP extensions.
In order to keep the images smaller, PHP’s source is kept in a compressed tar file. To facilitate linking of PHP’s source with any extension, we also provide the helper script docker-php-source
to easily extract the tar or delete the extracted source. Note: if you do use docker-php-source
to extract the source, be sure to delete it in the same layer of the docker image.
FROM php:7.2-cli
RUN docker-php-source extract \
# do important things \
&& docker-php-source delete
PHP Core Extensions
For example, if you want to have a PHP-FPM image with iconv
and gd
extensions, you can inherit the base image that you like, and write your own Dockerfile
like this:
FROM php:7.2-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
Remember, you must install dependencies for your extensions manually. If an extension needs custom configure
arguments, you can use the docker-php-ext-configure
script like this example. There is no need to run docker-php-source
manually in this case, since that is handled by the configure
and install
scripts.
See “Dockerizing Compiled Software” for a description of the technique Tianon uses for determining the necessary build-time dependencies for any bit of software (which applies directly to compiling PHP extensions).
[转]Docker php extensions gd的更多相关文章
- Docker运行sonarqube-(代码质量检测平台)
sonarqube是什么 SonarQube是用于持续检查代码质量的开源平台. 可用于持续集成,持续部署流程中的代码检测环节. idea和jenkins都提供了插件配合使用. liunx推荐配置环境 ...
- Helpers\RainCaptcha
Helpers\RainCaptcha This class can validate CAPTCHA images with RainCaptcha. It can generate an URL ...
- 安装Zabbix5.0
目录 概述 支持的平台 安全相关 支持TimescaleDB agent升级 垂直菜单 部署 安装要求 数据库要求 前端要求 服务端要求 Agent 2 Java gateway 安装 配置镜像源 安 ...
- Jenkins+Sonar 项目构建前代码审查
一.sonar简介 1.概述 Sonar (SonarQube)是一个开源平台,用于持续检查代码质量,不只是一个质量数据报告工具,更是代码质量管理平台. 支持Java, C#, C/C++, PL/S ...
- 部署Zabbix 6.0 LTS
Blog:博客园 个人 本部署文档适用于CentOS 8.X/RHEL 8.X/Anolis OS 8.X/AlmaLinux 8.X. Zabbix 6.0 LTS于2022年2月15日发布,本次大 ...
- 给docker里的php安装gd扩展
docker官方镜像为安装php扩展封装了函数,为开发者提供了很大的便利,以下以Dockerfile的形式演示安装gd扩展的方法,安装gd扩展需要安装几个依赖包,安装依赖包使用系统命令,安装命令根据基 ...
- docker安装GD扩展
apt update #更新软件源 apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev #安装各种库 docker-p ...
- Docker为PHP安装gd扩展
安装扩展库的通常命令 docker-php-ext-install 扩展库名 安装gd库需要特殊照顾,步骤如下 //进入PHP容器 //更新软件源 apt update //安装各种库 apt ins ...
- Docker的镜像
镜像是容器的运行基础,容器是镜像运行后台的形态 镜像的概念 镜像是一个包含程序运行必要依赖环境和代码的只读文件,它采用分层的文件系统,将每一次改变以读写层的形式增加到原来的只读文件上 镜像的系统结构 ...
随机推荐
- JObject,JArray的基本操作
引用:https://www.cnblogs.com/dacongge/p/6957074.html 1.JObject:基本的json对象 /// <summary> /// Gets ...
- JS求数组差集的几种方法
第一种:如果不考虑IE8的兼容性完全可以使用Foreach ,此方法求出arr1 减去 arr2的差集, arr1 = [1,2,3,4];arr2 = [1,2,3]; var subSet = f ...
- 只要一行代码求一串字符中某字符(串)出现次数,c#
这里只要一行代码就行. static void Main(string[] args) { string str = "qwerwqr;sfdsfds;fdfdsf;dfsdfsdf;dsf ...
- vue.js 2.0(2)
1.双向绑定v-model要写在输入框里 2.点击改变颜色:当index和isActive统一时,才会调用class html: function: css: 3.在同一 ...
- BiggerInteger类
java.math.BigInteger(需要导包)1.BigInteger构造方法*public BigInteger(String val)将 BigInteger 的十进制字符串表示形式转换为 ...
- Linux下Oracle表空间及用户创建
记录详细过程以备使用 Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 Connected as sys@i ...
- Must Know Tips/Tricks in Deep Neural Networks
Must Know Tips/Tricks in Deep Neural Networks (by Xiu-Shen Wei) Deep Neural Networks, especially C ...
- C#通过COM组件操作IE浏览器(三):了解IHTMLDocument2
IHTMLDocument2方法 说明 write 写入 writeln 写入并换行 open 打开一个流,以收集 document.write 或 document.writeln 的输出 clos ...
- Jquery Ajax Realize whether the user is registered
XMLHttpRequest对象可以在不向服务器提交整个页面的情况下,实现局部更新网页.当页面全部加载完毕后,客户端通过该对象向服务器请求数据,服务器端接受数据并处理后,向客户端反馈数据. XMLHt ...
- pm2日志管理pm2-logrotate介绍
先来看两个问题 问:pm2-logrotate是什么? 答:pm2-logrotate可以理解为是一个pm2的插件,它扩充了pm2本身没有功能:日志管理,所以它的运行需要依靠pm2,想用它必须先安装p ...