Centos7 安裝docker

系統環境 Centos7  64位  ,yum 源可以正常使用。

Docker 對磁盤空間容量要求比較高,磁盤容量是從宿主機上進行劃分,後期生成的鏡像也是佔用磁盤空間,在初始安裝docker時,根據實際情況分配磁盤容量。

Docker 軟件包已經包括在默認的 CentOS-Extras 軟件源裏,這裏安裝docker 採取默認的yum 源方式進行;

1. yum 方式安裝

[root@localhost ~]# yum install docker

2. 啓動 docker 服務,並將其設置爲開機啓動


[root@localhost ~]# service docker start

[root@localhost ~]# chkconfig docker on

(CentOS 7中支持的新式 systemd 語法,如下:

[root@localhost ~]# systemctl  start docker.service;[root@localhost ~]# systemctl  restart docker.service



[root@localhost /]# docker version

Client:

 Version:         1.10.3

 API version:     1.22

 Package version: docker-common-1.10.3-59.el7.centos.x86_64

 Go version:      go1.6.3

 Git commit:      3999ccb-unsupported

 Built:           Thu Dec 15 17:24:43 2016

 OS/Arch:         linux/amd64


Server:

 Version:         1.10.3

 API version:     1.22

 Package version: docker-common-1.10.3-59.el7.centos.x86_64

 Go version:      go1.6.3

 Git commit:      3999ccb-unsupported

 Built:           Thu Dec 15 17:24:43 2016

 OS/Arch:         linux/amd64

3.docker下載官方的 CentOS 鏡像到本地,配置 docker 加速器 linux 環境下 將該代碼 加入

curl -sSL https://get.daocloud.io/daotools/set_mirror.sh | sh -s http://73de5734.m.daocloud.io  

該腳本可以將 --registry-mirror 加入到 Docker 配置文件

下載 Centos 鏡像

[root@localhost ~]# docker pull centos

查看獲取鏡像

[root@localhost /]# docker p_w_picpaths

REPOSITORY    TAG   IMAGE ID    CREATED    SIZE

docker.io/centos              latest         67591570dd29        7 weeks ago         191.8 MB

運行docker 容器

[root@localhost /]# docker run -i -t 67591570dd29 /bin/bash

顯示當前運行的容器

[root@localhost ~]# docker ps

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               N

AMESc2b0e1333184        67591570dd29        "/bin/bash"         2 minutes ago       Up 2 minutes                            t

iny_hodgkin



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