Che: Help? Stuck customizing containers/work-spaces PHP, quick-start docker images don't have privileges?

Created on 20 Sep 2020  路  3Comments  路  Source: eclipse/che

Summary

I'm trying to configure a php images with modules not enabled by default in the PHP Quickstart Projects (Example: sudo apt install php-gmagick )
'image: 'quay.io/eclipse/che-php-7:7.17.0' OR
'image: quay.io/eclipse/che-php-base:7.4'
I'm trying to customize the quickstart workspace to import and run my existing PHP projects into Eclipse Che.

I can't seem to make updates to the images for my workspace. If I attempt to docker build with RUN commands to customize the image, or attempt management calls from within the terminal itself. I get the following:

$ apt-get update Reading package lists... Done E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied) E: Unable to lock directory /var/lib/apt/lists/ $ apt-get install sudo E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? $

Things I've tried / Questions:

Tried Using a Offical PHP Docker Image Instead: Pulling a php-base image for PHP from docker-hub in lieu of the eclipse che "quay.io" images. Results in the workspace _failing to start._ usually a non-descript null pointer exception. https://hub.docker.com/_/php

_Question?_ Can the Offical PHP images be customized to launch with Eclipse Che? What is "patched" ( aka what are the dependencies) of the eclispe-che php "quay.io" image that allows it to load the workspace?

Look for Documentation I cannot seem to find documentation on how to customize any image given in Eclipse Che.
Can anyone point me in the right direction for this?

I'm assuming this is possible Am I missing something important here?

Relevant information

Eclipse Che 7.17.0 - PHP with SQL, PHP simple application. Quickstart.

areplugins kinquestion

Most helpful comment

@Mbd06b yes the containers are rootless in che, and yes you can customize them, creating a docker image that extends the existing one. As for where to find the source docker images, you can look at this file, then you would create a github repo with a dockerfile that as first does something like:
Dockerfile FROM quay.io/eclipse/che-php-base:7.4 RUN docker-php-ext-install gmagick
after doing this you can create a repository in quay.io that is linked to your github repo, then in quay you can create a build trigger that creates the docker image from your dockerfile. After doing this you will end up with a quay.io/your_username/some_name:latest (or whatever you choose for this part).

then in your devfile (the ones you use to customize your che workspaces), you would change the line
````yaml
components:

  • mountSources: true
    endpoints:

    • name: 8000-tcp

      port: 8000

      memoryLimit: 512Mi

      type: dockerimage

      volumes:

    • name: composer

      containerPath: /home/user/.composer

      alias: php

      image: 'quay.io/eclipse/che-php-7:7.18.2' <<<<====

      ````

for the one you just created.

I have not done this before with the PHP image but I can see there is 2 repos for it in quay, one is https://quay.io/repository/eclipse/che-php-7 and the other one is quay.io/eclipse/che-php-base, I don't know the difference between them really.

All 3 comments

@Mbd06b yes the containers are rootless in che, and yes you can customize them, creating a docker image that extends the existing one. As for where to find the source docker images, you can look at this file, then you would create a github repo with a dockerfile that as first does something like:
Dockerfile FROM quay.io/eclipse/che-php-base:7.4 RUN docker-php-ext-install gmagick
after doing this you can create a repository in quay.io that is linked to your github repo, then in quay you can create a build trigger that creates the docker image from your dockerfile. After doing this you will end up with a quay.io/your_username/some_name:latest (or whatever you choose for this part).

then in your devfile (the ones you use to customize your che workspaces), you would change the line
````yaml
components:

  • mountSources: true
    endpoints:

    • name: 8000-tcp

      port: 8000

      memoryLimit: 512Mi

      type: dockerimage

      volumes:

    • name: composer

      containerPath: /home/user/.composer

      alias: php

      image: 'quay.io/eclipse/che-php-7:7.18.2' <<<<====

      ````

for the one you just created.

I have not done this before with the PHP image but I can see there is 2 repos for it in quay, one is https://quay.io/repository/eclipse/che-php-7 and the other one is quay.io/eclipse/che-php-base, I don't know the difference between them really.

I have not done this before with the PHP image but I can see there is 2 repos for it in quay, one is https://quay.io/repository/eclipse/che-php-7 and the other one is quay.io/eclipse/che-php-base, I don't know the difference between them really.

che-php-7 uses che-php-base as a base image. If you want to extend Eclipse Che's PHP image, I'd recommend using che-php-7 as a base and take it from there.

Thanks for the tips.

understanding the 'docker-php-ext-install'

was the clue I needed to get things going again.

I was able to customize the "che-php-base" image well enough, but was still encountering permissions errors with "apt-get" and "docker-php-ext-install" trying to perform any changes to the "che-php-7*" images in the quick-start"

Was this page helpful?
0 / 5 - 0 ratings