suse 12 脚本部署docker(二进制文件)

简介: suse 12 脚本部署docker(二进制文件)
suse-linux:~ # cat /etc/issue
Welcome to SUSE Linux Enterprise Server 12 SP3  (x86_64) - Kernel \r (\l).
suse-linux:~ # uname -a
Linux suse-linux 4.4.73-5-default #1 SMP Tue Jul 4 15:33:39 UTC 2017 (b7ce4e4) x86_64 x86_64 x86_64 GNU/Linux
suse-linux:~ # systemctl status SuSEfirewall2   # suse的firewalld和centos不一样
● SuSEfirewall2.service - SuSEfirewall2 phase 2
   Loaded: loaded (/usr/lib/systemd/system/SuSEfirewall2.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
`README:`
'此脚本是二进制的方式部署docker,比较适合suse 12发行版的linux,centots和redhat,可以使用yum的方式部署'
'脚本默认部署的是19.03.9版本的docker,需要其他版本,修改getPackage函数内version变量即可'
'本地没有网络的情况下,提前准备好tgz二进制包,并注释getPackage函数内的wget这一行即可'
'imageJson内配置了阿里云镜像加速,如果有自己的私仓,可以修改这里面的内容'
#!/usr/bin/env bash
set -e
getPackage(){
local version=docker-19.03.9
wget https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/static/stable/x86_64/${version}.tgz --no-check-certificate
tar xf ${version}.tgz
}
setService(){
mv docker/* /usr/bin/ && rm -rf docker
cat > /etc/systemd/system/docker.service <<-EOF
[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 -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
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
EOF
}
imageJson(){
mkdir /etc/docker
cat > /etc/docker/daemon.json <<-EOF
{
  "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"],
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2",
  "storage-opts": [
    "overlay2.override_kernel_check=true"
  ]
}
EOF
systemctl daemon-reload && \
systemctl enable docker --now
}
main(){
getPackage
setService
imageJson
}
main
status=$(ps -ef | grep [do]cker | wc -l )
if [ ${status} -gt 1 ];
then
    echo "docker is running"
else
    echo "have some error!"
    exit 1
fi
目录
相关文章
|
1月前
|
JavaScript 算法 前端开发
【Docker项目实战】使用Docker部署paopao-ce微社区
【Docker项目实战】使用Docker部署paopao-ce微社区
217 84
【Docker项目实战】使用Docker部署paopao-ce微社区
|
21天前
|
存储 Docker Python
docker 部署 sftp
本文介绍SFTP服务的部署与配置,包括users.conf用户配置规则、Docker容器运行命令及上传目录权限说明,重点解析atmoz/sftp镜像的chroot机制与子目录映射,确保用户登录后正确访问/upload目录,并提供Python脚本实现文件上传示例。
72 12
docker 部署 sftp
|
22天前
|
运维 Linux 数据库
基于 Docker 部署 n8n 指南,新手一看就会
本教程详解如何通过 Docker 快速部署开源自动化工具 n8n,适合新手快速上手。内容涵盖官方部署步骤、常见难点及第三方一键部署方案,助你高效搭建自动化工作流平台。
381 6
|
29天前
|
前端开发 JavaScript 应用服务中间件
在Docker部署的前端应用中使用动态环境变量
以上步骤展示了如何在 Docker 配置过程中处理并注入环墨遁形成可执行操作流程,并确保最终用户能够无缝地与之交互而无须关心背后复杂性。
89 13
|
1月前
|
存储 Kubernetes 持续交付
为什么Docker容器化改变了开发与部署?
为什么Docker容器化改变了开发与部署?
|
Docker 容器 Ubuntu
《第一本Docker书(修订版)》——2.7 Docker安装脚本
还有另外一种方法,就是使用远程安装脚本在相应的宿主机上安装Docker。可以从get.docker.com网站获取这个安装脚本。
1974 0
|
3月前
|
存储 监控 测试技术
如何将现有的应用程序迁移到Docker容器中?
如何将现有的应用程序迁移到Docker容器中?
289 57
|
4月前
|
存储 运维 安全
Docker化运维:容器部署的实践指南
Docker化运维:容器部署的实践指南