fix(docker): 用 tmpfs mode=1777 替换 uid/gid 选项以兼容 Podman
This commit is contained in:
parent
af3cd4b525
commit
e18d2bfb2c
@ -20,7 +20,11 @@ pub static DOCKER_CLIENT: LazyLock<Docker> = LazyLock::new(|| {
|
||||
|
||||
pub fn build_host_config(limits: &ResourceLimits) -> HostConfig {
|
||||
let mut tmpfs = HashMap::new();
|
||||
tmpfs.insert("/code".to_string(), "size=16m,uid=1000,gid=1000".to_string());
|
||||
// /code 用 mode=1777(sticky + all-rwx)让容器内 1000:1000 用户可写。
|
||||
// 不用 `uid=1000,gid=1000`:那是 Docker 的 tmpfs 扩展选项,Podman 报
|
||||
// `unknown mount option "uid=1000"`。mode=1777 是 POSIX 标准 tmpfs 选项,
|
||||
// Docker 与 Podman 都支持,语义等价(任意 UID 可写 /code)。
|
||||
tmpfs.insert("/code".to_string(), "size=16m,mode=1777".to_string());
|
||||
// /tmp 必须 exec:编译型语言(go/rust)把编译产物落在 /tmp 后再 exec,
|
||||
// Docker tmpfs 默认 noexec 会让执行二进制时报 EACCES(permission denied)。
|
||||
// 解释型语言(python/node)执行根文件系统的解释器,不受影响。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user