安裝前準備工作
1. 查看Linux內核版本, 版本必須大於2.6.24
shell: uname -a
2. 檢查Device Mapper (存儲驅動)
shell: ls -l /sys/class/misc/device-mapper
Centos安裝Dcoker的方式
yum安裝
1. 更新yum庫 shell:yum update 2. 新增Docker的yum源 shell:tee /etc/yum.repos.d/docker.repo <<-'EOF' [dockerrepo] name=Docker Repository baseurl=https://yum.dockerproject.org/repo/main/centos/7/ enabled=1 gpgcheck=1 gpgkey=https://yum.dockerproject.org/gpg EOF 3. 安裝Docker包 shell:yum install docker-engine 4. 啓動Docker shell:service docker start 5. 測試Docker是否正確安裝 shell:$ docker run hello-world
腳本安裝
1. 更新yum庫 shell:yum update 2. 運行Docker安裝腳本 shell:curl -fsSL https://get.docker.com/ | sodu sh 3. 啓動Docker shell:service docker start 4. 測試Docker是否正確安裝 shell:$ sudo docker run hello-world
創建用戶組
使用非root用戶時,需要給docker添加用戶組
1. groupadd docker //docker爲用戶組名
2. gpasswd -a ${USER} docker //將當前用戶添加到docker用戶組中
3. service docker restart //重啓docker