gpt4 book ai didi

Docker:将 Linux korn Shell 添加到现有容器

转载 作者:行者123 更新时间:2023-12-04 18:39:39 24 4
gpt4 key购买 nike

我对 docker 很陌生,我想将 Linux Korn Shell 添加到现有容器中。

我使用了这个命令:

  yum install ksh 

我收到这些错误:
    fastesmirror
Loading mirror speeds from cached hostfile
* epel: fedora-archive.ip-connect.vn.ua
* epel-debuginfo: fedora-archive.mirror.liquidtelecom.com
* epel-source: fedora-archive.mirror.liquidtelecom.com
Setting up Install Process
No package ksh available.
Nothing to do

有人可以帮我安装 ksh 吗?

谢谢 !

PS:这是一个 Ubuntu 8.3.0

最佳答案

在 Ubuntu 上,您需要使用 apt-get 而不是 yum 来安装任何软件包。所以要安装ksh,需要使用命令apt-get -y install ksh .这是我的 Dockerfile-

FROM ubuntu:18.04

RUN apt-get -qqy update && apt-get dist-upgrade -qqy && apt-get -y install ksh

这是我的容器的输出,显示确实安装了 ksh -
root@qa6:~/amitp/p1# docker run -it 948453249b61 bash
root@ea237be38b71:/# ksh
# echo $0
ksh
#

更新 :
以上是在构建容器镜像时安装了 ksh 的容器。如果您有任何现有的 Ubuntu 容器正在运行,请使用如下所示的类似命令安装 ksh-
root@qa6:~/amitp/p1# docker run -it 72300a873c2c bash
root@5c844bb2b7ad:/# ksh
bash: ksh: command not found
root@5c844bb2b7ad:/# apt-get -qqy update && apt-get dist-upgrade -qqy && apt-get -y install ksh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
binfmt-support libpipeline1
The following NEW packages will be installed:
binfmt-support ksh libpipeline1
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 921 kB of archives.
After this operation, 3665 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpipeline1 amd64 1.5.0-1 [25.3 kB]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 binfmt-support amd64 2.1.8-2 [51.6 kB]
Get:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 ksh amd64 93u+20120801-3.1ubuntu1 [844 kB]
Fetched 921 kB in 1s (793 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libpipeline1:amd64.
(Reading database ... 4046 files and directories currently installed.)
Preparing to unpack .../libpipeline1_1.5.0-1_amd64.deb ...
Unpacking libpipeline1:amd64 (1.5.0-1) ...
Selecting previously unselected package binfmt-support.
Preparing to unpack .../binfmt-support_2.1.8-2_amd64.deb ...
Unpacking binfmt-support (2.1.8-2) ...
Selecting previously unselected package ksh.
Preparing to unpack .../ksh_93u+20120801-3.1ubuntu1_amd64.deb ...
Unpacking ksh (93u+20120801-3.1ubuntu1) ...
Setting up libpipeline1:amd64 (1.5.0-1) ...
Setting up binfmt-support (2.1.8-2) ...
update-binfmts: warning: Couldn't load the binfmt_misc module.
invoke-rc.d: could not determine current runlevel
invoke-rc.d: policy-rc.d denied execution of start.
Setting up ksh (93u+20120801-3.1ubuntu1) ...
update-alternatives: using /bin/ksh93 to provide /bin/ksh (ksh) in auto mode
update-alternatives: warning: skip creation of /usr/share/man/man1/ksh.1.gz because associated file /usr/share/man/man1/ksh93.1.gz (of link group ksh) doesn't exist
update-binfmts: warning: Couldn't load the binfmt_misc module.
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@5c844bb2b7ad:/# ksh
#

关于Docker:将 Linux korn Shell 添加到现有容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60603730/

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