docker教程1:CentOS系統(tǒng)上安裝Docker |
系統(tǒng)要求:CentOS 7.x 中安裝 docker。
CentOS 7 中 Docker 的安裝
備注:(如采用CentOS 7中支持的新式 systemd 語(yǔ)法,如下:
下載官方的 CentOS 鏡像到本地:[root@localhost ~]# docker pull centos 確認(rèn) CentOS 鏡像已經(jīng)下載成功:[root@localhost ~]# docker images centos 運(yùn)行一個(gè) Docker 容器:[root@localhost ~]# docker run -i -t centos /bin/bash 說(shuō)明:我們可以看到,CentOS 容器已經(jīng)被啟動(dòng),并且我們得到了 bash 提示符。在 docker 命令中我們使用了 “-i 捕獲標(biāo)準(zhǔn)輸入輸出”和 “-t 分配一個(gè)終端或控制臺(tái)”選項(xiàng)。若要斷開(kāi)與容器的連接,輸入 exit。
還可以搜索基于 Fedora 和 Ubuntu 操作系統(tǒng)的容器。代碼如下: |