关于Docker的介绍,也很多。我文笔也不好。也不拷贝别人的成果了。
后续DevOps工具链基本都是基于Docker容器进行创建的。这里先写一下Docker的安装。以后安装Docker只需要拷贝三个文件,然后赋执行权限,然后执行脚本即可
我就写一下,我自己平常怎么操作
安装脚本 installDocker.sh :
#!/bin/bash
echo "start install docker"
tar -xvf ./docker-18.06.1-ce.tgz
cp docker/* /usr/bin/
cp docker.service /etc/systemd/system/docker.service
chmod +x /etc/systemd/system/docker.service
echo "install complete"
echo "run docker"
systemctl daemon-reload
systemctl start docker
echo "docker run success"
echo "set auto enable"
systemctl enable docker.service
docker -v
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
ExecStart=/usr/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
# restart the docker process if it exits prematurely
Restart=on-failure
StartLimitBurst=3
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
将这两个文件保存到和Docker安装同一级目录下。然后给安装脚本赋予执行权限:
chmod +x installDocker.sh
执行脚本
./installDocker.sh
看到
Docker version 18.06.1-ce, build e68fc7a
即代表安装成功。
docker pull
docker run
docker save
docker images