我在 centos 7 主机上运行 docker 映像 (gitlab-runner)。容器里奇怪的是有apt命令却没有yum命令。但是系统好像是centos而不是ubuntu?
root@vultr:/usr/local/java# uname -r
3.10.0-1062.4.1.el7.x86_64
我使用 apt-get install yum 安装 yum,然后我想做 yum update,但是出现以下问题,如何处理?
root@vultr:/usr/local/java# yum update
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
You can enable repos with yum-config-manager --enable <repo>
root@vultr:/usr/local/java# yum repolist all
repolist: 0
root@vultr:/usr/local/java# yum list
root@vultr:/usr/local/java#
root@vultr:/usr/local/java#
root@vultr:/usr/local/java# yum-config-manager --enable
Error: Trying to enable already enabled repos.
==================================================================================================== main ====================================================================================================
[main]
alwaysprompt = True
assumeyes = False
bandwidth = 0
bugtracker_url = http://yum.baseurl.org/report
cache = 0
cachedir = /var/cache/yum
clean_requirements_on_remove = False
color = auto
color_list_available_downgrade = dim,cyan
color_list_available_install = normal
color_list_available_reinstall = bold,underline,green
color_list_available_upgrade = bold,blue
color_list_installed_extra = bold,red
color_list_installed_newer = bold,yellow
color_list_installed_older = bold
color_list_installed_reinstall = normal
color_search_match = bold
color_update_installed = normal
color_update_local = bold
color_update_remote = normal
commands =
debuglevel = 2
diskspacecheck = True
distroverpkg = redhat-release
enable_group_conditionals = True
enabled = True
enablegroups = True
errorlevel = 2
exactarch = True
exactarchlist = kernel,
kernel-smp,
kernel-hugemem,
kernel-enterprise,
kernel-bigmem,
kernel-devel,
kernel-PAE,
kernel-PAE-debug
exclude =
exit_on_lock = False
failovermethod = roundrobin
gaftonmode = False
gpgcheck = False
group_package_types = mandatory,
default
groupremove_leaf_only = False
history_list_view = single-user-commands
答案1
GitLab Runner 镜像基于 Ubuntu 或 Alpine Linux。这是有说明的在文档中:
以下 Docker 镜像可用:
gitlab/gitlab-runner:latest
基于Ubuntu。gitlab/gitlab-runner:alpine
基于 Alpine,占用空间小得多(~160/350 MB Ubuntu 与~45/130 MB Alpine 压缩/解压缩)。
Ubuntu 和 Alpine Linux 都有自己的包管理系统 -apt
和apk
。您可以使用这些包管理器在容器内添加/删除包。yum
是 RHEL/Fedora 类 Linux 发行版的包管理器,Ubuntu 或 Alpine Linux 均不使用。