1. 程式人生 > >docker基礎容器中bash: sudo: command not found問題解決

docker基礎容器中bash: sudo: command not found問題解決

問題

我們在建立基礎容器之後,進入容器,使用sudo許可權進行下載的時候,但是會出現:
在這裡插入圖片描述

解決

需要更新一遍軟體源,選擇適當的debian映象,這裡以163的映象為例:

wget http://mirrors.163.com/.help/sources.list.squeeze
mv sources.list.squeeze sources.list

因為配置檔案中有一個源已經失效了,所以要修改一個地方,使用vi sources.list開啟,把倒數第二個源註釋掉。

注意:這裡如果使用vi提示錯誤,則需要看我上一篇部落格docker基礎容器中bash: vi: command not found問題解決

...
deb http://http.us.debian.org/debian squeeze main contrib non-free
# deb http://non-us.debian.org/debian-non-US squeeze/non-US main contrib non-free
deb http://security.debian.org squeeze/updates main contrib non-free

然後就可以更新了。

mv sources.list /etc/apt/
apt-get update
apt-get install sudo