首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >LXC -无法从linux容器访问包管理器

LXC -无法从linux容器访问包管理器
EN

Stack Overflow用户
提问于 2018-06-10 06:41:09
回答 1查看 243关注 0票数 0

我在fedora 27机器上安装了LXD。我在一段时间前对其进行了配置,并且它一直工作得很好,以至于我忘记了我是如何设置所有内容的。我刚刚尝试创建一个新的容器,它创建成功了,但是我无法让它访问包管理器。我隐约记得这是一个问题,当我创建我的其他容器时,我安装了所有的东西,但我不记得我是如何修复它的。到目前为止,我的其他旧容器工作得很好,并且可以访问包管理器,一切都很好。但是当我创建一个新的容器时,它就好像包管理器不存在一样。

如何使用LXD将包管理器安装到新的Linux Container?

谢谢,

-Yurelle

代码语言:javascript
复制
[root@neon ~]# lxc launch images:fedora/27 myThing
Creating myThing
Starting myThing
[root@neon ~]# lxc exec myThing bash
[root@myThing ~]# apt
bash: apt: command not found
[root@myThing ~]# apt-get
bash: apt-get: command not found
[root@myThing ~]# yum
bash: yum: command not found
[root@myThing ~]# rpm
RPM version 4.14.1
Copyright (C) 1998-2002 - Red Hat, Inc.
This program may be freely redistributed under the terms of the GNU GPL

Usage: rpm [-afgpcdLAlsiv?] [-a|--all] [-f|--file] [-g|--group] [-p|--package] [--pkgid] [--hdrid] [--triggeredby] [--whatrequires] [--whatprovides] [--whatrecommends]
        [--whatsuggests] [--whatsupplements] [--whatenhances] [--nomanifest] [-c|--configfiles] [-d|--docfiles] [-L|--licensefiles] [-A|--artifactfiles] [--dump] [-l|--list]
        [--queryformat=QUERYFORMAT] [-s|--state] [--nofiledigest] [--nofiles] [--nodeps] [--noscript] [--allfiles] [--allmatches] [--badreloc] [-e|--erase=<package>+]
        [--excludedocs] [--excludepath=<path>] [--force] [-F|--freshen=<packagefile>+] [-h|--hash] [--ignorearch] [--ignoreos] [--ignoresize] [-i|--install] [--justdb]
        [--nodeps] [--nofiledigest] [--nocontexts] [--nocaps] [--noorder] [--noscripts] [--notriggers] [--oldpackage] [--percent] [--prefix=<dir>] [--relocate=<old>=<new>]
        [--replacefiles] [--replacepkgs] [--test] [-U|--upgrade=<packagefile>+] [--reinstall=<packagefile>+] [-D|--define='MACRO EXPR'] [--undefine=MACRO] [-E|--eval='EXPR']
        [--target=CPU-VENDOR-OS] [--macros=<FILE:...>] [--noplugins] [--nodigest] [--nosignature] [--rcfile=<FILE:...>] [-r|--root=ROOT] [--dbpath=DIRECTORY] [--querytags]
        [--showrc] [--quiet] [-v|--verbose] [--version] [-?|--help] [--usage] [--scripts] [--setperms] [--setugids] [--conflicts] [--obsoletes] [--provides] [--requires]
        [--recommends] [--suggests] [--supplements] [--enhances] [--info] [--changelog] [--changes] [--xml] [--triggers] [--filetriggers] [--last] [--dupes] [--filesbypkg]
        [--fileclass] [--filecolor] [--fileprovide] [--filerequire] [--filecaps]
[root@myThing ~]# exit
exit
[root@neon ~]# lxc info myThing
Name: myThing
Remote: unix://
Architecture: x86_64
Created: 2018/06/09 22:24 UTC
Status: Running
Type: persistent
Profiles: default
Pid: 32310
Ips:
  eth0: inet    10.0.1.234      veth62EL09
  eth0: inet6   fe80::216:3eff:fe13:5c02        veth62EL09
  lo:   inet    127.0.0.1
  lo:   inet6   ::1
Resources:
  Processes: 7
  Disk usage:
    root: 7.71MB
  CPU usage:
    CPU usage (in seconds): 0
  Memory usage:
    Memory (current): 37.62MB
    Memory (peak): 39.65MB
  Network usage:
    eth0:
      Bytes received: 10.46kB
      Bytes sent: 3.68kB
      Packets received: 77
      Packets sent: 36
    lo:
      Bytes received: 510B
      Bytes sent: 510B
      Packets received: 6
      Packets sent: 6
[root@neon ~]#
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-06-10 07:00:36

好吧,我是个笨蛋,Fedora镜像默认使用DNF包管理器。所以,要么使用它,要么使用它安装yum:

代码语言:javascript
复制
[root@neon ~]# lxc launch images:fedora/27 myThing
Creating myThing
Starting myThing
[root@neon ~]# lxc exec myThing bash
[root@myThing ~]# dnf update
Last metadata expiration check: 0:42:05 ago on Sat Jun  9 22:24:14 2018.
Dependencies resolved.
Nothing to do.
Complete!
[root@myThing ~]# dnf install yum
Last metadata expiration check: 0:42:12 ago on Sat Jun  9 22:24:14 2018.
Dependencies resolved.
...
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50779137

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档