Issue
-
Running tasks on docker images that work correctly on the command line results in permission issues.
-
Eg. Running
sh 'npm install package_blah'
results in something similar to:npm ERR! Error: Invalid name: "@adsk/lmv"
. -
Eg. Running
sh 'pip install package_blah'
on thepython
image results in something similar to:error: [Errno 13] Permission denied: '/usr/local/lib/python/site-packages/version.py'
-
Resolution
First determine that the commands you are running work using docker without the plugin (command line).
Assuming everything works natively, then determine what user is running these commands for the image (command line):
docker run -it <image> whoami
Specify that user in the Docker Pipeline job to ensure that the same user it used.
The below example shows how to run pip install
with the python:2.7
docker image:
docker.image('python:2.7').withRun('-u my_user') { sh 'pip install version' }