如何在Docker上安装mcrypt [英] How to install mcrypt on Docker
问题描述
我有一个带有Phalcon3和php 7的Docker容器.我正在尝试安装php扩展名Mcrypt,但不走运.
I have a Docker Container with Phalcon3 and php 7. I am trying to install the php extension Mcrypt without luck.
如果我对容器执行ssh并执行:
If I do ssh to the container, and execute:
apt-get update
apt-get install php7.0-mcrypt
我得到以下信息:
E: Unable to locate package php7.0-mcrypt
E: Couldn't find any package by regex 'php7.0-mcrypt'
有没有办法安装它?
推荐答案
让我们看看 php的官方手册docker映像 部分PHP核心扩展
例如,如果您想要一个带有iconv的PHP-FPM图像,则mcrypt 和gd扩展名,您可以继承自己喜欢的基本图片,并且 像这样编写自己的Dockerfile:
For example, if you want to have a PHP-FPM image with iconv, mcrypt and gd extensions, you can inherit the base image that you like, and write your own Dockerfile like this:
FROM php:7.0-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
&& docker-php-ext-install -j$(nproc) iconv mcrypt \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd
Rember,您必须手动安装扩展的依赖项.如果 扩展程序需要自定义的configure参数,您可以使用 像此示例一样的docker-php-ext-configure脚本.没有必要 在这种情况下,请手动运行docker-php-source,因为这是由 配置和安装脚本.
Rember, 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.
这篇关于如何在Docker上安装mcrypt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!