当前位置:   article > 正文

docker中apt update报错解决记录

docker中apt update报错解决记录

问题

docker(ubuntu 22.04)中运行apt update报错:

Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [129 kB]
Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease    
  Couldn't create temporary file /tmp/apt.conf.XXLh0Z for passing config to apt-key
Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease
  Couldn't create temporary file /tmp/apt.conf.Y0klwg for passing config to apt-key
Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [128 kB]
Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
  Couldn't create temporary file /tmp/apt.conf.FVVrOZ for passing config to apt-key
Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [127 kB]
Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
  Couldn't create temporary file /tmp/apt.conf.2CBY68 for passing config to apt-key
Reading package lists... Done
W: GPG error: http://security.ubuntu.com/ubuntu jammy-security InRelease: Couldn't create temporary file /tmp/apt.conf.XXLh0Z for passing config to apt-key
E: The repository 'http://security.ubuntu.com/ubuntu jammy-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy InRelease: Couldn't create temporary file /tmp/apt.conf.Y0klwg for passing config to apt-key
E: The repository 'http://archive.ubuntu.com/ubuntu jammy InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-updates InRelease: Couldn't create temporary file /tmp/apt.conf.FVVrOZ for passing config to apt-key
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu jammy-backports InRelease: Couldn't create temporary file /tmp/apt.conf.2CBY68 for passing config to apt-key
E: The repository 'http://archive.ubuntu.com/ubuntu jammy-backports InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29

解决方案:

检查/tmp目录的权限:ls -ld /tmp

drwxrwxr-x 2 1007 1008 4096 Jan 11  2024 /tmp
  • 1

修改权限:chmod 1777 /tmp (在docker中默认有root权限,所以不需要sudo)

drwxrwxrwt 1 1007 1008 4096 Jan 11  2024 /tmp
  • 1

再次执行apt update就不报错了。

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号