You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何解决lambci/lambda:python3.6容器中无su/sudo却需root权限的安装困境

How to Install Packages with Yum in lambci/lambda:python3.6 Without Sudo/Su

Got it, let's break this down. The lambci/lambda:python3.6 image runs as the non-root lambda user by default—this is to mimic the actual AWS Lambda execution environment, which is why you don't have sudo or su available, and yum install throws a permission error.

Here's the straightforward fix to get root access and use yum:

  • Start the container as the root user directly
    Run this command instead of your original one:
    docker run -v "$PWD":/var/task --user root --entrypoint bash -it lambci/lambda:python3.6
    
    Adding the --user root flag launches the container with full root privileges right away. Once you're in the interactive shell, you can run yum install <package-name> without any permission issues—no need for sudo or su at all.

A quick note: While running as root deviates from the default Lambda runtime setup, it's the only practical way to install system-level packages in this image when you need them for testing or development.

内容的提问来源于stack exchange,提问作者Hello lad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:20:19