kubernetes部署 docker 容器

docker 容器相对比较简单,不涉及认证授权,只需要本地启动起来即可,唯一需要注意就是添加flannel网络。

# yum remove docker-latest-logrotate docker-logrotate docker-selinux dockdocker-engine #清除以前的docker

添加docker的服务文件

cat > /lib/systemd/system/docker.service <<"EOF"
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.io

[Service]
Type=notify
EnvironmentFile=-/run/flannel/docker
ExecStart=/usr/local/bin/dockerd --log-level=error $DOCKER_NETWORK_OPTIONS
ExecReload=/bin/kill -s HUP $MAINPID
Restart=on-failure
RestartSec=5
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
Delegate=yes
KillMode=process

[Install]
WantedBy=multi-user.target
EOF

启动docker,绿色代表启动成功

# for SERVICES in docker;do systemctl enable $SERVICES; systemctl start $SERVICES; systemctl status $SERVICES; done

验证

#ip a

3: flannel.1:  mtu 1450 qdisc noqueue state UNKNOWN 
    link/ether 2a:bd:11:f7:6c:b8 brd ff:ff:ff:ff:ff:ff
    inet 172.30.47.0/32 scope global flannel.1
       valid_lft forever preferred_lft forever
    inet6 fe80::28bd:11ff:fef7:6cb8/64 scope link 
       valid_lft forever preferred_lft forever
4: docker0:  mtu 1500 qdisc noqueue state DOWN 
    link/ether 02:42:f7:5d:42:f3 brd ff:ff:ff:ff:ff:ff
    inet 172.30.47.1/24 scope global docker0
       valid_lft forever preferred_lft forever

 

转载于:https://www.cnblogs.com/xuyingzhong/p/9671826.html

你可能感兴趣的:(kubernetes部署 docker 容器)