Custom s2i in OpenShift as an Image Stream - permissions error

1.2k Views Asked by At

I have am using a custom Source-to-image project for build drupal images, to run on OpenShift.

The s2i project works well when run locally, from the cli.

I tried to set this up in OpenShift using instructions from https://docs.openshift.com/container-platform/3.4/dev_guide/managing_images.html#writing-image-streams-for-s2i-builders.

S2i Project

The Drupal s2i project is located at https://github.com/hughestech/s2i-shepherd-drupal

ImageStream

My yam file looks like:

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'

However, when I run this (via the OpenShift web console > Catalog > PHP, I get the following errors:

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

Clearly I need to give permissions - but how and where? Is this something I need to do in OpenShift? Does the directory that the source is being pulled into even exist in the s2i project, or is it created when the s2i process runs in OpenShift?

Build pod error

/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
0

There are 0 best solutions below