本文转自: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-configuredocker-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的更多相关文章

  1. Docker运行sonarqube-(代码质量检测平台)

    sonarqube是什么 SonarQube是用于持续检查代码质量的开源平台. 可用于持续集成,持续部署流程中的代码检测环节. idea和jenkins都提供了插件配合使用. liunx推荐配置环境 ...

  2. Helpers\RainCaptcha

    Helpers\RainCaptcha This class can validate CAPTCHA images with RainCaptcha. It can generate an URL ...

  3. 安装Zabbix5.0

    目录 概述 支持的平台 安全相关 支持TimescaleDB agent升级 垂直菜单 部署 安装要求 数据库要求 前端要求 服务端要求 Agent 2 Java gateway 安装 配置镜像源 安 ...

  4. Jenkins+Sonar 项目构建前代码审查

    一.sonar简介 1.概述 Sonar (SonarQube)是一个开源平台,用于持续检查代码质量,不只是一个质量数据报告工具,更是代码质量管理平台. 支持Java, C#, C/C++, PL/S ...

  5. 部署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日发布,本次大 ...

  6. 给docker里的php安装gd扩展

    docker官方镜像为安装php扩展封装了函数,为开发者提供了很大的便利,以下以Dockerfile的形式演示安装gd扩展的方法,安装gd扩展需要安装几个依赖包,安装依赖包使用系统命令,安装命令根据基 ...

  7. docker安装GD扩展

    apt update #更新软件源 apt install -y libwebp-dev libjpeg-dev libpng-dev libfreetype6-dev #安装各种库 docker-p ...

  8. Docker为PHP安装gd扩展

    安装扩展库的通常命令 docker-php-ext-install 扩展库名 安装gd库需要特殊照顾,步骤如下 //进入PHP容器 //更新软件源 apt update //安装各种库 apt ins ...

  9. Docker的镜像

    镜像是容器的运行基础,容器是镜像运行后台的形态 镜像的概念 镜像是一个包含程序运行必要依赖环境和代码的只读文件,它采用分层的文件系统,将每一次改变以读写层的形式增加到原来的只读文件上 镜像的系统结构 ...

随机推荐

  1. ie9 css文件大小限制

    使用webpack生成CSS对于一些有趣的定义很有趣.不幸的是,当你拥有一个大型应用程序并且需要IE9支持时,乐趣就会停止,因为IE9会忽略你生成的CSS包中的大于4000个选择器的部分.解决方案是将 ...

  2. ssh 使用 sed 替换的时候,替换的字符串有单双引号的时候怎么用

    线上有一个脚本需要 ssh 登录远程机,然后完成特定文件中的某个值,替换的字符中有单引号,所以需要特定的写法,才能成功 1).ssh 远程执行命令,替换字符串中有单引号( ' ) ssh zhuzi@ ...

  3. easyui 日期控件,选择日期小于等于当前日期,开始日期小于等于结束日期

    转载出处:http://blog.csdn.net/u013755149/article/details/76613028 $(function(){ $('#start_date').datebox ...

  4. FPGA定点小数计算中截位形式的探讨

    在FPGA设计过程中难免会碰到需要进行截位,那定点小数的计算过程中我们需要注意些什么呢? 首先,我们考虑如下计算式. sin cos 数据形式是 FIX_32_30 X Y Z 数据形式是 FIX_3 ...

  5. HDFS基本架构及概念介绍

    简单介绍 l  设计思想 分而治之:将大文件.大批量文件,分布式存放在大量服务器上,以便于采取分而治之的方式对海量数据进行运算分析: l  在大数据系统中作用: 为各类分布式运算框架(如:mapred ...

  6. day_7数据类型的相互转换,与字符编码

    首先复一下昨天的内容 1:深浅拷贝 1:值拷贝 直接赋值 列表1=列表2       列表1中的任何值发生改变,列表2中的值都会随之改变 2:浅拷贝,列表2=列表1  列表1中存放的值的地址没有改变, ...

  7. java.lang.OutOfMemoryError: PermGen space (jvm内存泄漏解决办法)

    2.在myeclipse根目录 打开myeclipse.ini 3.在myeclipse中配置内存

  8. [转] Snapshotting with libvirt for qcow2 images

    http://kashyapc.com/2011/10/04/snapshotting-with-libvirt-for-qcow2-images/ Libvirt 0.9.6 was recentl ...

  9. iOS开发之Alamofire源码解析

    今天博客中的Alamofire源码的版本是以3.4版本为例.上篇博客系统的对NSURLSession相关的东西进行了详细的解析,详情请看<详解NSURLSession>,为了就是给本篇博客 ...

  10. Postman+Newman+jenkins实现API自动化测试

    最近自己在学习用postman+newman+jenkins实现API自动化测试,这里做个回顾和记录.(此次是在windows上进行的环境搭建) 一.说明 1.大致思路:利用postman做接口调试所 ...