我目前有一个用 php 5.4 构建的遗留应用程序,我正在尝试将其迁移到 openshift。
但是,php 5.4 似乎不能作为 openshift 3.5 中的默认容器镜像使用。这是我的 buildconfig 文件的一部分。
...
source:
type: Git
git:
uri: 'https://xxx.git'
ref: master
secrets: null
strategy:
type: Source
sourceStrategy:
from:
kind: ImageStreamTag
namespace: openshift
name: 'php:5.5'
...
到目前为止,一切都按预期进行。但是,在 sourceStrategy 部分,如果我将名称更改为:“name: 'php:5.4'”,它会失败。
有什么办法可以得到php 5.4的环境吗?
此网址似乎有一个 php 5.4 墨盒: https://github.com/openshift-cartridges/origin-community-cartridges/tree/master/openshift-origin-cartridge-php-5.4
我如何将它集成到我的 openshift 环境中?
我目前正在测试机器上运行 openshift 容器平台 3.5。
谢谢。
最佳答案
正如 Graham 在评论中提到的,Software Collections Library 不提供 PHP 5.4 的容器,但是没有什么可以阻止您创建自己的镜像并将其部署到您的 OpenShift 环境。
创建一个安装 PHP 5.4 的镜像,例如 Dockerfile:
FROM centos:7
RUN yum install -y php-common php-cli ftp://rpmfind.net/linux/centos/7.3.1611/os/x86_64/Packages/php-5.4.16-42.el7.x86_64.rpm
CMD ["php", "-v"]
运行以下命令构建镜像并将其推送到Dockerhub
docker build -t docker.io/your-username/php:5.4 。
docker push docker.io/你的用户名/php:5.4
然后您可以使用此图像创建 ImageStream 或直接在 containers:["image"]
下的 DeploymentConfig 中引用 Docker hub 上的图像
关于php - Openshift 使用替代容器镜像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44272761/