简体   繁体   English

如何在Docker内部的ubuntu容器中使用apt-get安装软件包

[英]How to install a package using apt-get in ubuntu container inside Docker

I have installed docker on windows 10. After that, pull the ubuntu container. 我已经在Windows 10上安装了docker。之后,拉出ubuntu容器。 After running the container with this docker run -t -i --privileged ubuntu bash or docker run -it ubuntu command, I've get this root@7f72926f3608:/# in console. 这种运行容器后docker run -t -i --privileged ubuntu bashdocker run -it ubuntu命令,我已经得到这root@7f72926f3608:/#控制台。

Then, try to install the python package using apt-get like $sudo apt-get install python or apt-get install python , but I've gotten the following error in console: 然后,尝试使用apt-get来安装python包,例如$sudo apt-get install pythonapt-get install python ,但在控制台中出现以下错误:

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

Hence, the question is how can I install a package in ubuntu container inside docker? 因此, 问题是如何在docker内部的ubuntu容器中安装软件包?

运行apt-get update ,然后安装软件包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM