gpt4 book ai didi

docker - 在 Docker 上创建本地 Ubuntu 存储库

转载 作者:行者123 更新时间:2023-12-02 19:30:14 25 4
gpt4 key购买 nike

我正在尝试在基于 Ubuntu 16.04 xenial 的 Docker 容器上创建本地 Ubuntu 存储库。我遵循了本教程:
https://help.ubuntu.com/community/Repositories/Personal

这里以root用户身份执行的步骤:

1. mkdir -p /root/repo/amd_64
2. copied all debian packages in /root/repo/amd_64
3. create the script /usr/bin/update-mydebs.sh with the following content:
#! /bin/bash
cd /root/repo/amd_64
dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz
4. Run the script update-mydebs.sh (I verified the Packages.gz is
correctly created under /root/repo/amd_64)
5. Added the line in /etc/apt/source.list
deb file:/root/repo amd_64/

当我运行 apt-get update 时,我遇到了以下问题:
Get:1 file:/root/repo amd_64/ InRelease
Ign:1 file:/root/repo amd_64/ InRelease
Get:2 file:/root/repo amd_64/ Release
Ign:2 file:/root/repo amd_64/ Release
Get:3 file:/root/repo amd_64/ Packages [54.3 kB]
Ign:3 file:/root/repo amd_64/ Packages
Get:3 file:/root/repo amd_64/ Packages
Ign:3 file:/root/repo amd_64/ Packages
Get:3 file:/root/repo amd_64/ Packages
Ign:3 file:/root/repo amd_64/ Packages
Get:3 file:/root/repo amd_64/ Packages
Ign:3 file:/root/repo amd_64/ Packages
Get:3 file:/root/repo amd_64/ Packages
Ign:3 file:/root/repo amd_64/ Packages
Get:3 file:/root/repo amd_64/ Packages
Err:3 file:/root/repo amd_64/ Packages
File not found - /root/repo/amd_64/Packages (2: No such file or
directory)
Reading package lists... Done
N: Can't drop privileges for downloading as file
'/root/repo/amd_64/InRelease' couldn't be accessed by user '_apt'. -
pkgAcquire::Run (13: Permission denied)
W: The repository 'file:/root/repo amd_64/ Release' does not have a
Release file.
N: Data from such a repository can't be authenticated and is therefore
potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user
configuration details.
E: Failed to fetch file:/root/repo/amd_64/Packages File not found -
/root/repo/amd_64/Packages (2: No such file or directory)

试图解决这个问题,只需将/root/repo/amd_64/Packages 中的/root/repo/amd_64/Packages.gz 解压缩,文件未找到的问题就解决了,但出现了另一个错误:
Get:3 file:/root/repo amd_64/ Packages [169 kB]
Err:3 file:/root/repo amd_64/ Packages
Could not open file
/var/lib/apt/lists/partial/_root_repo_amd%5f64_Packages - open
(13: Permission denied)
Reading package lists... Done
N: Can't drop privileges for downloading as file
'/root/repo/amd_64/InRelease' couldn't be accessed by user '_apt'. -
pkgAcquire::Run (13: Permission denied)
W: The repository 'file:/root/repo amd_64/ Release' does not have a
Release file.
N: Data from such a repository can't be authenticated and is therefore
potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user c
configuration details.
E: Failed to fetch
store:/var/lib/apt/lists/partial/_root_repo_amd%5f64_Packages Could
not open file /var/lib/apt/lists/partial/_root_repo_amd%5f64_Packages
- open (13: Permission denied)
E: Some index files failed to download. They have been ignored, or old
ones used instead.

我注意到网上关于这个主题的所有教程都与我链接的教程相似,所以我认为它是正确的,但是当我们在 Docker 容器上应用该过程时,可能有一些必须更改的内容。
任何人都可以帮忙吗?

最佳答案

我也有这个问题。花了我很多搜索才能找到:
https://github.com/radeno/polyfill-service-docker/blob/master/Dockerfile

附注:

# work around the following APT issue by using "Acquire::GzipIndexes=false" (overriding "/etc/apt/apt.conf.d/docker-gzip-indexes")
# Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)
# ...
# E: Failed to fetch store:/var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages Could not open file /var/lib/apt/lists/partial/_tmp_tmp.ODWljpQfkE_._Packages - open (13: Permission denied)

作为更新命令的一部分添加后,这对本地存储库按预期工作。

关于docker - 在 Docker 上创建本地 Ubuntu 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52004393/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com