我有这个
文档文件
:
FROM python:3.7
CMD ["/bin/bash"]
而这
詹金斯档案
:
pipeline {
agent {
dockerfile {
filename 'Dockerfile'
}
}
stages {
stage('Install') {
steps {
sh 'pip install --upgrade pip'
}
}
}
这将导致以下错误:
The directory '/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
Downloading https://files.pythonhosted.org/packages/d8/f3/413bab4ff08e1fc4828dfc59996d721917df8e8583ea85385d51125dceff/pip-19.0.3-py2.py3-none-any.whl (1.4MB)
Installing collected packages: pip
Found existing installation: pip 19.0.2
Uninstalling pip-19.0.2:
Could not install packages due to an EnvironmentError: [Errno 13]
Permission denied: '/usr/local/bin/pip'
Consider using the `--user` option or check the permissions.
我试图使用
--user
,但没有成功。
我用args有点运气
--user 0:0
在docker jenkinsfile声明中,但这会创建根目录和根目录下的文件,用户jenkins在下次运行时无法删除这些目录和文件。
我不想做
pip install
在dockerfile上,因为实际上安装步骤运行的是make文件,而不是我上面使用的简化,我希望在其他上下文中使用。
我也看到了改变
HOME environment var
,这似乎修复了有关父目录不属于当前用户的前两个警告,但没有
Errno 13
部分。