首先给个链接,必须支持原创作者,尝试多种方法,只有看他的安装教程,我成功了!【贴在这里】
https://www.cnblogs.com/kingsonfu/p/11576797.html
口水一下:
最开始我是想本地化kobas,进行批量通路富集,折腾过后(win mac linux离线安装kobas没成功),下载了一个kobas的docker镜像,并且在别人的服务器上完美实现批量富集。顿觉docker是个好东西,网上很多人都这么说。这里就尝试自己单独给自己服务器安装docker了。ps:这次docker告捷,下次我就来写写docker下kobas批量通路富集的帖子。
1. 下载docker压缩包并解压查看
[root@bignode1]$ wget -c https://download.docker.com/linux/static/stable/x86_64/docker-18.06.3-ce.tgz
[root@bignode1]$ tar -xvf docker-18.06.3-ce.tgz
docker/
docker/docker-containerd
docker/docker-proxy
docker/docker
docker/docker-runc
docker/dockerd
docker/docker-containerd-ctr
docker/docker-containerd-shim
docker/docker-init
2. 执行程序试试
[root@bignode1]$ cd docker/
[root@bignode1]$ l
total 141M
-rwxr-xr-x 1 test test 36M Feb 20 2019 docker
-rwxr-xr-x 1 test test 26M Feb 20 2019 docker-containerd
-rwxr-xr-x 1 test test 15M Feb 20 2019 docker-containerd-ctr
-rwxr-xr-x 1 test test 4.0M Feb 20 2019 docker-containerd-shim
-rwxr-xr-x 1 test test 51M Feb 20 2019 dockerd
-rwxr-xr-x 1 test test 747K Feb 20 2019 docker-init
-rwxr-xr-x 1 test test 2.8M Feb 20 2019 docker-proxy
-rwxr-xr-x 1 test test 7.2M Feb 20 2019 docker-runc
[root@bignode1]$ ./docker
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
Options:
--config string Location of client config files (default "/root/.docker")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal")
(default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit
......[余下不贴]
3. 拷贝至root下制定路径(/usr/bin)
[root@bignode1]# cp docker/* /usr/bin/
4. 在/etc/systemd/system/目录下新增docker.service,将docker注册为service服务 【文末附docker.service内容】
[root@bignode1]$ vim /etc/systemd/system/docker.service #粘贴文末文本
[root@bignode1]$ chmod +x /etc/systemd/system/docker.service
5. 其他操作
[root@bignode1]$ systemctl daemon-reload #重新加载配置文件(每次有修改docker.service文件时都要重新加载下)
[root@bignode1]$ systemctl start docker #启动docker
[root@bignode1]$ systemctl enable docker.service #设置开机启动
[root@bignode1]$ systemctl status docker #查看docker服务状态
总结几个小点:
用yum安装docker,无论是镜像还是离线.rpm包最好联网使用,难免有时候下载一些依赖;不推荐rpm包和镜像安装(当然包括docker官网下得到的get-docker.sh),prequirties安装设置但凡有一点点问题,有可能报各种错误如提示container-selinux >= 2:2.74,selinux-policy >= 3.13.1-216.el7,而这些依赖去解决又费时费力。另外,当我在docker官网https://docs.docker.com/engine/install/centos/飞奔并尝试他的方法时候,还差点上了系统版本(CentOS 7 or 8)的当,后来者也可能需要注意呀。
image.png
docker.service
对了,原作者提示“127.0.0.1”该IP需要改改,我不懂,因为我也不涉及,干脆直接沿用,也没什么bug出现。
[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 --selinux-enabled=false --insecure-registry=127.0.0.1
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
网友评论