Php OpenShift中的自定义s2i作为图像流-权限错误

Php OpenShift中的自定义s2i作为图像流-权限错误,php,openshift,s2i,Php,Openshift,S2i,我正在使用一个定制的源代码到图像项目来构建drupal图像,并在OpenShift上运行 s2i项目在从cli本地运行时运行良好 我尝试使用来自的指令在OpenShift中设置此设置 S2i项目 Drupal s2i项目位于 ImageStream 我的yam文件如下所示: apiVersion: v1 kind: ImageStream metadata: name: drupal annotations: openshift.io/display-name: Drupal

我正在使用一个定制的源代码到图像项目来构建drupal图像,并在OpenShift上运行

s2i项目在从cli本地运行时运行良好

我尝试使用来自的指令在OpenShift中设置此设置

S2i项目

Drupal s2i项目位于

ImageStream

我的yam文件如下所示:

apiVersion: v1
kind: ImageStream
metadata:
  name: drupal
  annotations:
    openshift.io/display-name: Drupal 
spec:
  tags:
    - name: '2.0' 
      annotations:
        openshift.io/display-name: Drupal Builder 
        description: >- 
          Build and run Drupal applications on CentOS 7. 
        iconClass: icon-php 
        sampleRepo: 'https://github.com/hughestech/open_social.git' 
        tags: 'builder,php, drupal' 
        version: '1.0' 
      from:
        kind: DockerImage
        name: '172.30.1.121:5000/test/s2i-shepherd-drupal:latest'
但是,当我运行这个(通过OpenShift web控制台>目录>PHP)时,会出现以下错误:

cp: cannot create regular file '././phpunit.xml.dist': Permission denied
cp: cannot create regular file '././social.info.yml': Permission denied
cp: cannot create regular file '././social.install': Permission denied
cp: cannot create regular file '././social.profile': Permission denied
cp: cannot create regular file '././.gitignore': Permission denied
cp: cannot create regular file '././.travis.yml': Permission denied
cp: cannot create regular file '././README.md': Permission denied
cp: cannot create regular file '././build-social.make': Permission denied
cp: cannot create regular file '././composer.json': Permission denied
cp: cannot create regular file '././drupal-org-core.make': Permission denied
cp: cannot create regular file '././drupal-org.make': Permission denied
cp: cannot create directory '././.git': Permission denied
cp: cannot create directory '././config': Permission denied
cp: cannot create directory '././libraries': Permission denied
cp: cannot create directory '././modules': Permission denied
cp: cannot create directory '././themes': Permission denied
cp: cannot create directory '././src': Permission denied
cp: cannot create directory '././tests': Permission denied
显然,我需要授予权限-但是如何授予权限?在哪里授予权限?这是我需要在OpenShift中执行的操作吗?源代码要被拉入的目录是否存在于s2i项目中,还是在s2i进程在OpenShift中运行时创建的

构建吊舱错误

/apache2-foreground: 11: [: /var/www/html: unexpected operator
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.128.1.64. Set the 'ServerName' directive globally to suppress this message
[Tue Sep 12 13:07:05.474838 2017] [core:emerg] [pid 1] (13)Permission denied: AH00023: Couldn't create the rewrite-map mutex (file /var/lock/apache2/rewrite-map.1)
AH00016: Configuration Failed

您能否提供一个包含用于制作S2I builder的源代码的存储库的URL。它似乎没有正确设置文件系统权限。如果您能看到它是如何实现的,可以更好地指导您。是的,我已经更新了问题以包含此信息,谢谢Graham。从我所知,S2I builder的书面版本可以在使用
s2i
命令行工具生成图像,该工具可以使用
docker run
在OpenShift之外运行。它还没有完成在指定ID运行时允许其工作的工作,默认情况下在OpenShift下会发生这种情况。让图像在OpenShift中工作的唯一方法是,如果安全性放松,允许图像运行以anyuid身份运行。如果您正在使用OpenShift Online,则不允许在OpenShift Online中以anyuid身份运行图像。将此脚本添加到图像中。拥有
WORKDIR
be
/var/www
并且Apache/PHP正在使用它。运行
chown-R 1001:0/var/www
。组必须是
0
。并使用该
修复权限
脚本首先在
/var/www
上设置权限,然后在将任何文件添加到
/var/www
后,在任何需要的地方设置权限。只需确保它是可执行的。在OpenShift附带的S2I构建器中,它们将其粘贴在
/usr/bin
中,因此位于
路径
中。您可以提供包含该文件的存储库的URL吗用于创建S2I builder的urce代码。它似乎没有正确设置文件系统权限。如果您能了解它的实现方式,可以更好地指导您。是的,我已经更新了问题以包含此信息,感谢Graham。从我所知,编写的S2I builder只能使用
S2I
命令生成图像可以使用
docker run
在OpenShift外部运行的line工具。它还没有完成在分配ID运行时允许它工作的工作,而在OpenShift下默认情况下会发生这种情况。在OpenShift中让图像工作的唯一方法是,如果安全性被放松,允许图像以anyuid的形式运行。不允许以anyuid的形式运行图像如果您正在使用OpenShift Online,则允许在OpenShift Online中使用。将此脚本添加到您的图像中。使用
WORKDIR
be
/var/www
,并且Apache/PHP正在使用它。运行
chown-R 1001:0/var/www
。组必须是
0
。并使用该
修复权限
脚本来修复
/var/www
上的权限,缩写y、 然后,在任何文件被添加到
/var/www
之后。只要确保它是可执行的。在OpenShift附带的S2I构建器中,它们将它粘贴在
/usr/bin
路径中。