docker安装:
1下载:
https://get.docker.com/builds/Linux/x86_64/docker-1.12.3.tgz
2解压并查看docker版本:
补充: --strip-components N 去除N层目录结构 -C指定解压位置
3 在防火墙上打开docker对应端口,(明哥不确定这一步需不需要,这里先略过。后面我还会再回来的)
4启动docker
5这里需要有一个开机自启动的脚本(这个shell脚本是我复制过来的,实际上只运行到第四步即可)
1编写开机启动脚本
vi /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network.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
ExecStart=/usr/local/bin/dockerd
ExecReload=/bin/kill -s HUP $MAINPID
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity
# Uncomment TasksMax if your systemd version supports it.
# Only systemd 226 and above support this version.
#TasksMax=infinity
TimeoutStartSec=0
# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes
# kill only the docker process, not all processes in the cgroup
KillMode=process
[Install]
WantedBy=multi-user.target
2设置开机启动
systemctl enable docker.service
3重启服务器
reboot