我正在尝试在 Azure 管道中运行 CI/CD。因为我的应用程序需要一些仅适用于 ubuntu 18.04 的依赖项,但该 VmImage 版本在 Azure 托管代理中已弃用。这就是为什么我在 ubuntu 18.04 docker 容器上运行它。 docker 容器似乎没有安装 sudo,所以我尝试安装它。这是我的管道代码
pool:
vmImage: ubuntu-latest
container: ubuntu:18.04
dependsOn: ImpactedProjects
condition: eq(dependencies.ImpactedProjects.outputs['ImpactAnalysis.Project.Loyalty.QueryCachePopulator.AzureFunction.BddTests'], 'True')
steps:
- script: apt-get install sudo
displayName: 'Install sudo'
但是我收到了这个错误
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
##[error]Bash exited with code '100'.
Finishing: Install sudo
有谁知道如何解决这个问题吗?谢谢
您需要成为 Docker 容器中的
root
用户,才能安装软件包。如果您使用 docker run
命令运行此命令,请尝试将以下环境变量设置为 docker run
命令的一部分:
-e USERID=0 -e GROUPID=0