CentOS 7下 Docker 安装
“CentOS 7下 Docker安装”
前言
正文
1、安装CentOS 7
下载
Ali-OSM
安装 略
确认内核版本
uname -r
3.10.0-514.16.1.el7.x86_64
需大于3.10
2、获取docker国内加速连接
这里使用阿里的
https://cr.console.aliyun.com/#/accelerator
3、添加yum源
sudo 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
4、安装
sudo yum install docker-engine
5、使用加速连接
新建 docker 文件
echo DOCKER_OPTS=”-H unix:///var/run/docker.sock -H 0.0.0.0:2375 –registry-mirror=国内仓库地址” >> /etc/sysconfig/docker
修改 docker.service 添加 DOCKER_OPTS
vim /lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target firewalld.service
Wants=network-online.target
[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
EnvironmentFile=-/etc/sysconfig/docker
ExecStart=/usr/bin/dockerd $DOCKER_OPTS
...
6、启动
sudo systemctl start docker
查看 是否启动成功
ps -ef | grep docker
看见参数 则启动成功
尾巴
接下来 开始愉快的 Docker 之旅吧!
参考
https://dcos.io/docs/1.7/administration/installing/custom/system-requirements/install-docker-centos/
著作权声明
本文首次发布于 Binux Blog,转载请保留以上链接