Che: Add an ability to specify entrypoint for dockerimage tool in Devfile

Created on 14 Feb 2019  路  9Comments  路  Source: eclipse/che

Description

There are cases when a user wants to use some official docker image in dockerimage tool but default entrypoint is not suitable for his needs. In this case, it is needed to have an ability to specify entrypoint and arguments for dockerimage tool in Devfile.
The proposal is to add two optional fields command and arguments which type is string array. It's the same as Kubernetes Container model has https://docs.openshift.com/container-platform/3.5/rest_api/kubernetes_v1.html#v1-container.
It would look like the following

  - name: nodejs
    type: dockerimage
    image: node:0.10.40
    command: ['/bin/sh', '-c']
    args: ['tail -f /dev/null']
kinenhancement severitP1 statuopen-for-dev teaplatform

All 9 comments

@l0rd Do you think the proposed format is good, or it would be better to have something like current devfile draft has entryPoint: sleep infinity https://github.com/redhat-developer/devfile/blob/master/Devfile.yaml#L13 ?

@sleshchenko command and args is perfect.

Here is a technical issue in implementing it. We convert dockerimage tool to an environment with dockerimage recipe. For example:

  - name: che-dev
    type: dockerimage
    image: eclipse/che-dev:nightly
    env:
      - name: CHE_LOGS_DIR
        value: /home/user/che-logs
    endpoints:
      - name: tomcat
        port: 8080
        attributes:
          public: 'true'
    volumes:
      - name: maven
        containerPath: /home/user/.m2
    memoryLimit: 1.5G
    mountSources: true

Will be converted to

{
    "che-dev": {
        "machines": {
            "che-dev": {
                "attributes": {
                    "memoryLimitBytes": "1500000000"
                },
                "servers": {
                    "tomcat": {
                        "attributes": {
                            "public": "true"
                        },
                        "port": "8080",
                        "protocol": "http"
                    }
                },
                "volumes": {
                    "projects": {
                        "path": "/projects"
                    },
                    "maven": {
                        "path": "/home/user/.m2"
                    }
                },
                "installers": [],
                "env": {
                    "CHE_LOGS_DIR": "/home/user/che-logs"
                }
            }
        },
        "recipe": {
            "type": "dockerimage",
            "content": "eclipse/che-dev:nightly"
        }
    }
}

And the issue that currently there is no an ability to specify entrypoint for dockerimage machine.
Possible solution would be add an ability to define entrypoint via machine configuration attributes, then we would be able to specify something like that:

{
    "che-dev": {
        "machines": {
            "che-dev": {
                "attributes": {
                    "memoryLimitBytes": "1500000000",
                    "command": "['/bin/sh', '-c']",
                    "args": "['tail -f /dev/null']"
                },
                ...
            }
        },
        "recipe": {
            "type": "dockerimage",
            "content": "eclipse/che-dev:nightly"
        }
    }
}

Attributes names can be more self-explaining, like containerCommand, containerArgs.
@garagatyi @skabashnyuk WDYT? Which attributes names do you like more?

:+1: to use attributes until we remove workspace config and start using devfile directly.
I'm OK with the proposed names

馃憤 for containerCommand and containerArgs

ok for me.

The fool of me forgot about the second PR :)

Both PRs are merged, so I'm closing this issue. Yay!

@metlos 馃帀 馃帀 馃帀

Was this page helpful?
0 / 5 - 0 ratings