Authoring devfiles - ComponentsAdding a volume component

Authoring devfiles - Components

Adding a volume component

You can use a volume component to share files among container components and collaborate with other teams during the development process. Volumes mounted in a container require a volume component with the same name. Volume components can be shared across container components.

Prerequisites

Procedure

  1. Add a volume component and specify the size of it.

    Minimal volume example

    devfile.yaml
    schemaVersion: 2.2.0 metadata:  name: mydevfile components:  - name: mydevfile  container:  image: golang  memoryLimit: 512Mi  mountSources: true  command: ['sleep', 'infinity']  volumeMounts:  - name: cache  path: /.cache  - name: cache  volume:  size: 2Gi 
  2. If you do not want your volume component to persist across restarts, specify it as ephemeral.

    Ephemeral volume example

    devfile.yaml
    schemaVersion: 2.2.0 metadata:  name: mydevfile components:  - name: mydevfile  volume:  ephemeral: true  size: 200G 

Note!

Specifying the size of a volume component is dependent on the tools you use and might be subject to the limitations of the tools.

Additional resources