【问题标题】:Automatic building and installing Packages from AUR for Arch Linux inside Docker with yaourt and >makepkg-4.2.0使用 yaourt 和 >makepkg-4.2.0 在 Docker 内为 Arch Linux 自动构建和安装 AUR 包
【发布时间】:2015-08-20 11:16:32
【问题描述】:

我在 Docker-Container 中使用 Docker 和 Arch Linux。 介绍 ma​​kepkg-4.2.0 我的 yaourt 安装命令被破坏,如下所述:https://github.com/archlinuxfr/yaourt/issues/67

问题是,yaourt 应该以非 root 用户身份运行。但是由于 yaourt 还希望在每个案例中都安装包,所以在构建它之后,需要 root 用户或具有安装包权限的用户。

所以我的问题是如何解决这个问题?我想在 Docker 中从 AUR 安装一个包,因为还没有官方包。

直到现在我还在使用 Arch Linux、pacman 和 yaourt。

所以命令,

RUN yaourt -S --noconfirm aur/taskd

安装taskd,在makepkg-4.2.0之前工作:

使用新的 makepkg 版本构建 Docker 失败,并出现以下来自 yaourt 的错误:

makepkg: invalid option '--asroot'

如果我将用户更改为非 root 用户并尝试安装包,我会在自动构建中收到命令提示符,要求输入 Root 密码以实际安装包。

Password: su: Authentication information cannot be recovered
Password: su: Authentication information cannot be recovered
Password: su: Authentication information cannot be recovered
The command [/bin/sh -c yaourt -S --noconfirm aur/taskd] returned a non-zero code: 1

在不污染分布在两个 Dockerfile 上的许多离题行的情况下,Dockerfile 的有趣部分如下所示:

FROM kaot/arch_linux_base:latest
MAINTAINER Kaot
RUN useradd --no-create-home --shell=/bin/false yaourt && usermod -L yaourt
RUN yaourt -S --noconfirm aur/taskd
ENTRYPOINT ["/controlcenter/controlcenter.sh"]
CMD ["cc:start"]

【问题讨论】:

  • 你能展示你的 Dockerfile 或复制器吗?
  • @user2915097:我添加了一个最小的 Dockerfile,它应该包含重要的行,而忽略了离题的行。

标签: docker archlinux


【解决方案1】:

如果找到一个解决方案,让 yaourt 只下载如何构建包的信息,然后使用非 root 用户调用 makepkg 本身,然后使用 root 用户和 pacman 安装构建包。 Dockerfile 的部分如下所示

RUN mkdir -p /tmp/Package/ && chown yaourt /tmp/Package
USER yaourt
RUN cd /tmp/Package && pwd && ls -al && yaourt --getpkgbuild aur/taskd && cd taskd && makepkg --pkg taskd 
USER root
RUN pacman -U --noconfirm /tmp/Package/taskd/taskd-1.1.0-1-x86_64.pkg.tar.xz

使用一些变量,可以实现进一步的增强,但原则上这是可行的。

【讨论】:

    猜你喜欢
    • 2020-10-14
    • 2014-02-09
    • 1970-01-01
    • 2019-08-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-18
    • 2021-03-21
    相关资源
    最近更新 更多