docker-maven-plugin icon indicating copy to clipboard operation
docker-maven-plugin copied to clipboard

Creating Docker Volumes with an ownership different from the root user

Open OpenPj opened this issue 2 years ago • 1 comments

Description

I'm wondering if it's possible to configure in the plugin configuration inside the pom.xml the creation of a new Docker Volume with a different ownership in terms of the user that can manage the file system in the Docker Volume.

In a Docker Compose template it's possible to set the user that will take the ownership for also creating the new volumes. So it would be great to have the opportunity to have a similar way for doing the same in the plugin configuration in the pom.xml file.

Currently when I set a different user in the Dockerfile then the Docker Volume created is not usable due to permissions constraints related to the main container because it's using a different user for running the container. Everything is working only if I set root as the user that is running the container but it's something improper because the vendor is releasing a container that should run with a different user.

Is there any other way to achieve this?

Info

  • docker-maven-plugin version : 0.39.1
  • Maven version (mvn -v) : 3.8.5

  • Docker version : 20.10.16
  • If it's a feature request, what is your use case : a parameter to set the user for creating and manage Docker Volumes
  • Sample project : https://github.com/OpenPj/alfresco-process-services-project-sdk currently used in the Maven module named activiti-app-overlay-docker

I'm using your plugin in the Alfresco Process Services SDK, in order to build and run the entire platform on Docker. Recently Alfresco changed the default user inside their containers so it would be great to have a way for creating and manage Docker Volumes with the alfresco user.

OpenPj avatar Jun 09 '22 10:06 OpenPj

You can set the owner and group of a volume as described in https://dmp.fabric8.io/#docker:volume-create (see the <opts> configuration). Is this good enough for your use case?

rhuss avatar Jul 29 '22 14:07 rhuss