【问题标题】:Docker images lacking /tmp?Docker 镜像缺少 /tmp?
【发布时间】:2018-12-27 19:42:53
【问题描述】:

我试图基于this one构建一个基于Debian Stretch的图像,并且在运行apt-get update时不断出现这种错误:

W: GPG error: http://security.debian.org stretch/updates InRelease: Couldn't create temporary file /tmp/apt.conf.FNG6R8 for passing config to apt-key

刚刚添加后已修复此问题

mkdir /tmp && chmod 777 /tmp \

到 Dockerfile RUN。但接下来的问题是,Docker 镜像是否缺少 tmp 文件?仅基于buildpack-deps:stretch-scm 的图像是这种情况吗?有没有比手动创建/tmp 目录更好的方法来处理这个问题?

【问题讨论】:

  • 您缺少粘性位,您希望 /tmp 为 1777。

标签: docker debian dockerfile


【解决方案1】:

我遇到了和你一样的错误,正如 BMitch 建议的那样,在我的 Dockerfile 中添加这个层为我修复了它。

RUN chmod 1777 /tmp

【讨论】:

    【解决方案2】:

    /tmp 存在于图像中,您的问题在其他地方:

    $ docker run -it --rm buildpack-deps:stretch-scm /bin/bash
    root@c7fc40670734:/# ls -al /tmp
    total 8
    drwxrwxrwt 1 root root 4096 Nov 16 11:16 .
    drwxr-xr-x 1 root root 4096 Dec 27 19:48 ..
    

    注意 /tmp 应该设置为 1777,而不是 777,您需要粘性位以确保安全

    【讨论】:

      猜你喜欢
      • 2022-01-14
      • 1970-01-01
      • 2021-07-04
      • 2019-04-29
      • 2019-08-18
      • 2018-12-21
      • 2017-01-03
      • 2022-10-15
      • 1970-01-01
      相关资源
      最近更新 更多