【linux】ubuntu系统下lsb_release: command not found

在Ubuntu Docker容器中运行lsb_release -a命令时遇到'command not found'错误。解决方法是通过运行'apt-get install -y lsb-release'来安装缺失的包。安装完成后,系统会自动配置并可以成功运行lsb_release命令,验证结果显示Distributor ID为Ubuntu,版本为18.04.6 LTS。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

【linux】ubuntu系统下lsb_release: command not found

背景

dockerd容器里面,ubuntu系统下运行lsb_release -a命令报如下错误:

root@3fbaf54f21b4:/path# lsb_release -a
bash: lsb_release: command not found

解决办法

使用如下命令安装:

apt-get install -y lsb-release

安装细节:

root@3fbaf54f21b4:/path# apt-get install -y lsb-release
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  distro-info-data
Suggested packages:
  lsb
The following NEW packages will be installed:
  distro-info-data lsb-release
0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.
Need to get 15.6 kB of archives.
After this operation, 84.0 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 distro-info-data all 0.37ubuntu0.13 [4656 B]
Get:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 lsb-release all 9.20170808ubuntu1 [11.0 kB]
Fetched 15.6 kB in 1s (19.4 kB/s)     
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package distro-info-data.
(Reading database ... 20751 files and directories currently installed.)
Preparing to unpack .../distro-info-data_0.37ubuntu0.13_all.deb ...
Unpacking distro-info-data (0.37ubuntu0.13) ...
Selecting previously unselected package lsb-release.
Preparing to unpack .../lsb-release_9.20170808ubuntu1_all.deb ...
Unpacking lsb-release (9.20170808ubuntu1) ...
Setting up distro-info-data (0.37ubuntu0.13) ...
Setting up lsb-release (9.20170808ubuntu1) ...

验证

验证是否安装成功:

root@3fbaf54f21b4:/path# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.6 LTS
Release:        18.04
Codename:       bionic
root@3fbaf54f21b4:/path# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jn10010537

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值