Ubuntu Server 21.04 Install 二进制 Install docker&docker-compose

Posted CIAS

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu Server 21.04 Install 二进制 Install docker&docker-compose相关的知识,希望对你有一定的参考价值。

                    

docker版本以及操作系统下载使用说明

系统docker  docker-composeubuntu  系统安装下载MobaXterm 远程连接工具
Linux   版本    版本downloaddownload

Docker 

是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的镜像中,然后发布到任何流行的 Linux或Windows 机器上,也可以实现虚拟化。容器是完全使用沙箱机制,相互之间不会有任何接口。

Docker Compose 

Docker撰写依赖于Docker引擎来完成任何有意义的工作,因此请确保在本地或远程安装了Docker引擎,具体取决于您的设置。

一键部署基于二进制docker,docker-compoe 

vim /docker_install.sh
#!/bin/sh
# -*- coding: utf-8 -*-
# Author: CIASM
# update 2021-12-08
 
# Define docker path variables
DOCKER_URL=https://download.docker.com/linux/static/stable/x86_64/
DOCKER_FILE=docker-20.10.7.tgz 
DOCKER_catalogue=/opt/docker
DOCKER_download=/opt
DOCKER_PREFIX=/usr/bin/
 
# Define docker-compose path variables
DOCKER_compose_URL=https://github.com/docker/compose/releases/download/1.29.2/
DOCKER_compose_FILE=docker-compose-Linux-x86_64
 
# Depend on the installation
apt install -y firewalld apt-transport-https ca-certificates curl software-properties-common gcc
 
wget -N -P $DOCKER_download $DOCKER_URL/$DOCKER_FILE
 
tar -xf $DOCKER_download/$DOCKER_FILE  -C $DOCKER_download
 
cp -rf $DOCKER_catalogue/* $DOCKER_PREFIX
 
# Docker startup script
cat << EOF >  /usr/lib/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=https://download.docker.com/linux/static/stable/x86_64/
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
EOF
 
# start docker
systemctl daemon-reload && systemctl enable --now docker
 
# docker-compose Install
wget -N -P $DOCKER_download $DOCKER_compose_URL/$DOCKER_compose_FILE && mv $DOCKER_download/docker-compose-Linux-x86_64 /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
 
rm -rf $DOCKER_download/$DOCKER_FILE
  • 开始安装
sh /docker_install.sh

docker,docker-compose 安装版本查询

docker-compose --version && docker --version

 

以上是关于Ubuntu Server 21.04 Install 二进制 Install docker&docker-compose的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu Server 21.04 Install ansible

Ubuntu Server 21.04 Install ansible

Ubuntu Server 21.04 Install ansible

Ubuntu Server 21.04 Install one key Generic mysql 8.0.26

Ubuntu Server 21.04 Install Cockpit

Ubuntu Server 21.04 Install Cockpit