Ubuntu中安裝Docker的方式:

Ubuntu中安裝Docker的方式:

                

1.安裝Ubuntu維護的版本

sudo apt-get install docker.io

source /etc/bash_completion.d/docker.io

安裝完成:

sudo docker.io version(查看docker的版本)

2.安裝Docker維護的版本

1.檢查APT的HTTPS 支持 查看/usr/lib/apt/methods/https文件是否存在如果不存在,運行安裝命令

apt-get update

apt-get install -y apt-transport-https

2.添加Docker的APT倉庫

echo deb https://get.docker.com/ubuntu docker main>/etc/apt/sources.list.d/docker.list

3.添加倉庫的KEY

apt-key adv --keyserver hkp://keyserver.ubuntu.com:80--recv-keys

36A1d7869245C8950F966E92D8576A8BA88D21E9

4.安裝

apt-get update

apt-get install -y lxc-docker

(2)另一種簡單的安裝

1.sudo apt-get install -y curl

2.curl -sSL https://get.docker.com/ubuntu/ | sudo sh

3.curl的安裝

查看curl是否安裝;

whereis curl

安裝curl:

sudo apt-get install -y curl

利用裝好的Docker運行一個容器

讓容器輸出hello Word

sudo docker run ubuntu echo "Hellow word"

使用非root用戶:

1.sudo groupadd docker

2.sudo gpasswd -a${USER}docker

3.sudo service docker restart

                                       長按下方二維碼關注我們

                                 

                 

 

 

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章