Ubuntu Docker 安裝
Docker 支持以下的Ubuntu 版本:
- Ubuntu Precise 12.04 (LTS)
- Ubuntu Trusty 14.04 (LTS)
- Ubuntu Wily 15.10
- 其他更新的版本……
前提條件
Docker 要求Ubuntu 系統的內核版本高於3.10 ,查看本頁面的前提條件來驗證你的Ubuntu 版本是否支持Docker。
通過uname -r 命令查看你當前的內核版本
w3big@w3big:~$ uname -r
使用腳本安裝Docker
1、獲取最新版本的Docker 安裝包
w3big@w3big:~$ wget -qO- https://get.docker.com/ | sh
輸入當前用戶的密碼後,就會下載腳本並且安裝Docker及依賴包。
安裝完成後有個提示:
If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like: sudo usermod -aG docker w3big Remember that you will have to log out and back in for this to take effect!
當要以非root用戶可以直接運行docker時,需要執行sudo usermod -aG docker w3big命令,然後重新登陸,否則會有如下報錯
2、啟動docker 後台服務
w3big@w3big:~$ sudo service docker start
3、測試運行hello-world
w3big@w3big:~$ docker run hello-world