无法在 docker Ubuntu 映像中安装软件包 [英] Cannot install packages inside docker Ubuntu image

查看:53
本文介绍了无法在 docker Ubuntu 映像中安装软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 docker 上安装了 Ubuntu 14.04 镜像.之后,当我尝试在 ubuntu 映像中安装软件包时,我无法定位软件包错误:

I installed Ubuntu 14.04 image on docker. After that, when I try to install packages inside the ubuntu image, I'm getting unable to locate package error:

apt-get install curl

Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package curl

如何修复这个错误?

推荐答案

是因为图片中没有包缓存,需要运行:

It is because there is no package cache in the image, you need to run:

apt-get update

在安装软件包之前,如果您的命令在 Dockerfile 中,那么您将需要:

before installing packages, and if your command is in a Dockerfile, you'll then need:

apt-get -y install curl

要抑制命令的标准输出,请使用 -qq.例如

To suppress the standard output from a command use -qq. E.g.

apt-get -qq -y install curl

这篇关于无法在 docker Ubuntu 映像中安装软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆