linux中docker的安裝教程
Docker 軟件包已經(jīng)包括在默認(rèn)的 CentOS-Extras 軟件源里。因此想要安裝 docker,只需要運(yùn)行下面的 yum 命令:
[root@localhost ~]# yum install docker
啟動(dòng) Docker 服務(wù)
安裝完成后,使用下面的命令來(lái)啟動(dòng) docker 服務(wù),并將其設(shè)置為開(kāi)機(jī)啟動(dòng):
[root@localhost ~]# service docker start [root@localhost ~]# chkconfig docker on
(LCTT 譯注:此處采用了舊式的 sysv 語(yǔ)法,如采用CentOS 7中支持的新式 systemd 語(yǔ)法,如下:
[root@localhost ~]# systemctl start docker.service [root@localhost ~]# systemctl enable docker.service
)
下載官方的 CentOS 鏡像到本地
[root@localhost ~]# docker pull centos Pulling repository centos 192178b11d36: Download complete 70441cac1ed5: Download complete ae0c2d0bdc10: Download complete 511136ea3c5a: Download complete 5b12ef8fd570: Download complete
確認(rèn) CentOS 鏡像已經(jīng)被獲?。?/strong>
[root@localhost ~]# docker images centos REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE centos centos5 192178b11d36 2 weeks ago 466.9 MB centos centos6 70441cac1ed5 2 weeks ago 215.8 MB centos centos7 ae0c2d0bdc10 2 weeks ago 224 MB centos latest ae0c2d0bdc10 2 weeks ago 224 MB
運(yùn)行一個(gè) Docker 容器:
[root@localhost ~]# docker run -i -t centos /bin/bash [root@dbf66395436d /]#
我們可以看到,CentOS 容器已經(jīng)被啟動(dòng),并且我們得到了 bash 提示符。在 docker 命令中我們使用了 “-i 捕獲標(biāo)準(zhǔn)輸入輸出”和 “-t 分配一個(gè)終端或控制臺(tái)”選項(xiàng)。若要斷開(kāi)與容器的連接,輸入 exit。
[root@cd05639b3f5c /]# cat /etc/redhat-release CentOS Linux release 7.0.1406 (Core) [root@cd05639b3f5c /]# exit exit [root@localhost ~]#
我們還可以搜索基于 Fedora 和 Ubuntu 操作系統(tǒng)的容器。
[root@localhost ~]# docker search ubuntu [root@localhost ~]# docker search fedora
到此這篇關(guān)于linux中docker的安裝的文章就介紹到這了,更多相關(guān)linux docker安裝內(nèi)容請(qǐng)搜索本站以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持本站!
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非www.sddonglingsh.com所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。