Jib: Is there a way to add a volume in image ?

Created on 9 Oct 2018  路  9Comments  路  Source: GoogleContainerTools/jib

Image don't allows to have a volume:

my project is a CLI that uses a folder as arg to run. I would like to run produced docker image with a volume to bind to some host folder

Expected behavior:

add some volume parameter when configuring maven/gradle plugin

Most helpful comment

thanks you all for adding this feature in Jib!

All 9 comments

Hi @laurentleseigneur , thanks for your suggestions! Currently we do not provide configuration for setting the volume, but we'll look into this as a potential feature.

The proposal is to add a <container><volumes>/jib.container.volumes configuration parameter:

Examples:

<configuration>
  <container>
    <volumes>
      <volume>/var/job-result-data</volume>
      <volume>/var/log/my-app-logs</volume>
    <volumes>
  </container>
</configuration>
jib.container.volumes = ['/var/job-result-data', '/var/log/my-app-logs']
Jib.from(...)
   .addVolume('/var/job-result-data')
   .addVolume(AbsoluteUnixPath.get('/var/job-result-data'))
   .containerize(...);

This will add a "Volumes" section to the container configuration "config" object:

{
  "config": {
    ...
    "Volumes": {
      "/var/job-result-data": {},
      "/var/log/my-app-logs": {}
    },
  }
}

Hey @coollog wanna some help with these? This seems cool.

Hey @GuustavoPaiva , we鈥檇 be glad to have your help on this! Let us know if you have any questions. One thing is that this is probably better done as multiple PRs, like one for the jib-core changes, one for the jib-maven-plugin changes, and one for the jib-gradle-plugin changes.

@GuustavoPaiva , let us know if you'd like to handle the jib-maven-plugin/jib-gradle-plugin changes as well!

Hey @coollog I plan to do this by the end of this week, is it fine?

@GuustavoPaiva sure, we welcome your help.

Fixed by #1278. @GuustavoPaiva thanks again for your help!

thanks you all for adding this feature in Jib!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sakebook picture sakebook  路  5Comments

schmitch picture schmitch  路  3Comments

victornoel picture victornoel  路  5Comments

jack-kerouac picture jack-kerouac  路  6Comments

Daniil56 picture Daniil56  路  6Comments