首页 > 解决方案 > Docker 镜像缺少 /tmp?

问题描述

我试图基于这个基于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目录更好的方法来处理这个问题?

标签: dockerdebiandockerfile

解决方案


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

RUN chmod 1777 /tmp

推荐阅读