Running with – – allow-root option in Bitbucket pipeline

I’m trying to build the project using bitbucket pipeline. I’m using maven 3.3.9 image during the Pipeline build.

But while building the project, the build is failing with:

'Running bower install in /opt/atlasssian/pipelines/agent/build/fronted bower ESUDO cannot be run with sudo
You can, however, use a command with sudo using' - -allow-root' option.

I understand that running bower as root is restricted due to safety and we need to override it with - - allow-root.

Now how can I mention the - - allow-root when running through the docker maven image?

Source: StackOverflow