我正在尝试从官方 Arch Linux 映像构建 Docker 映像。这些是我到目前为止所做的事情:
我拉取了官方的 Arch Linux 镜像:
docker pull base/archlinux
我写了这个“Dockerfile”:
# Set base image
FROM base/archlinux:latest
# Fix mirrorlist file
#RUN rm /etc/pacman.d/mirrorlist
#RUN echo "Server = http://..." >> /etc/pacman.d/mirrorlist
#RUN echo "Server = http://..." >> /etc/pacman.d/mirrorlist
#RUN echo "Server = http://..." >> /etc/pacman.d/mirrorlist
#RUN echo "Server = http://..." >> /etc/pacman.d/mirrorlist
# Update pacman and install packages
RUN pacman-db-upgrade
RUN pacman -Syyu --noconfirm
RUN pacman -S --noconfirm nodejs phantomjs cronie
# Make cronjobs
RUN echo "*/2 * * * * node /srv/visitor/visitor.js" >> mycronjobs
RUN echo "*/5 * * * * killall -older-than 5m phantomjs" >> mycronjobs
RUN echo "0 0 * * * rm /srv/visitor/visitor-info.log" >> mycronjobs
RUN crontab mycronjobs
RUN rm mycronjobs
# Fix hosts file
RUN echo "192.92.13.243 www.lololol.gr"
# Copy app code
COPY . /srv/visitor
# Install app dependencies
RUN cd /srv/visitor
RUN npm install
EXPOSE 80
CMD ["/bin/bash"]
我想要的是在命令提示符下启动容器,以便我可以在交互模式下运行并附加到它。
现在,我在构建映像时收到此错误:
Step 3 : RUN pacman -S --noconfirm nodejs phantomjs cronie
---> Running in 30870b31aed6
error: failed to initialize alpm library
(database is incorrect version: /var/lib/pacman/)
error: try running pacman-db-upgrade
INFO[0127] The command [/bin/sh -c pacman -S --noconfirm nodejs phantomjs cronie] returned a non-zero code: 255
让我感到困惑的是,它看起来包数据库已正确更新,并且基础系统已升级,并且在尝试手动安装三个包时挂起。
有任何想法吗?
好吧,我根本不知道 Arch,但如果你这样做:
然后运行它来升级你当前的包:
您似乎刚刚升级了
pacman
任何其他涉及包数据库的工具,因此当您运行下一个pacman
命令时.........它失败了,因为当前安装的工具尚未升级包数据库。我怀疑您想重新排序这些
RUN
语句: