sh docker-install.sh 1.12.6    #ubuntu16.4 测试通过
#!/bin/sh
set -e
#
# This script is meant for quick & easy install via:
# 'curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh'
# or:
# 'wget -qO- http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh'
#
# For test builds (ie. release candidates):
# 'curl -fsSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/test/internet | sh'
# or:
# 'wget -qO- http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/test/internet | sh'
#
# For experimental builds:
# 'curl -fsSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/experimental/internet | sh'
# or:
# 'wget -qO- http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/experimental/internet | sh'
#
# Docker Maintainers:
# To update this script on https://get.docker.com,
# use hack/release.sh during a normal release,
# or the following one-liner for script hotfixes:
# aws s3 cp --acl public-read hack/install.sh s3://get.docker.com/index
# url="http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet"
apt_url="http://mirrors.aliyun.com/docker-engine/apt"
yum_url="http://mirrors.aliyun.com/docker-engine/yum"
gpg_fingerprint="58118E89F3A912897C070ADBF76221572C52609D" key_servers="
ha.pool.sks-keyservers.net
pgp.mit.edu
keyserver.ubuntu.com
" command_exists() {
command -v "$@" > /dev/null >&
} echo_docker_as_nonroot() {
if command_exists docker && [ -e /var/run/docker.sock ]; then
(
set -x
$sh_c 'docker version'
) || true
fi
your_user=your-user
[ "$user" != 'root' ] && your_user="$user"
# intentionally mixed spaces and tabs here -- tabs are stripped by "<<-EOF", spaces are kept in the output
cat <<-EOF If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like: sudo usermod -aG docker $your_user Remember that you will have to log out and back in for this to take effect! EOF
} # Check if this is a forked Linux distro
check_forked() { # Check for lsb_release command existence, it usually exists in forked distros
if command_exists lsb_release; then
# Check if the `-u` option is supported
set +e
lsb_release -a -u > /dev/null >&
lsb_release_exit_code=$?
set -e # Check if the command has exited successfully, it means we're in a forked distro
if [ "$lsb_release_exit_code" = "" ]; then
# Print info about current distro
cat <<-EOF
You're using '$lsb_dist' version '$dist_version'.
EOF # Get the upstream release info
d '[[:space:]]')
f | tr -d '[[:space:]]') # Print info about upstream distro
cat <<-EOF
Upstream release is '$lsb_dist' version '$dist_version'.
EOF
else
if [ -r /etc/debian_version ] && [ "$lsb_dist" != "ubuntu" ]; then
# We're Debian and don't even know it!
lsb_dist=debian
dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')"
case "$dist_version" in
|'Kali Linux 2')
dist_version="jessie"
;;
)
dist_version="wheezy"
;;
esac
fi
fi
fi
} rpm_import_repository_key() {
local key=$; shift
local tmpdir=$(mktemp -d)
chmod "$tmpdir"
for key_server in $key_servers ; do
gpg --homedir "$tmpdir" --keyserver "$key_server" --recv-keys "$key" && break
done
gpg --homedir "$tmpdir" -k "$key" >/dev/null
gpg --homedir "$tmpdir" --export --armor "$key" > "$tmpdir"/repo.key
rpm --import "$tmpdir"/repo.key
rm -rf "$tmpdir"
} semverParse() {
major="${1%%.*}"
minor="${1#$major.}"
minor="${minor%%.*}"
patch="${1#$major.$minor.}"
patch="${patch%%[-.]*}"
} do_install() {
case "$(uname -m)" in
*)
;;
*)
cat >& <<-'EOF'
Error: you are not using a 64bit platform.
Docker currently only supports 64bit platforms.
EOF
exit
;;
esac if command_exists docker; then
version="$(docker -v | awk -F '[ ,]+' '{ print $3 }')"
MAJOR_W=
MINOR_W= semverParse $version shouldWarn=
if [ $major -lt $MAJOR_W ]; then
shouldWarn=
fi if [ $major -le $MAJOR_W ] && [ $minor -lt $MINOR_W ]; then
shouldWarn=
fi cat >& <<-'EOF'
Warning: the "docker" command appears to already exist on this system. If you already have Docker installed, this script can cause trouble, which is
why we're displaying this warning and provide the opportunity to cancel the
installation. If you installed the current Docker package using this script and are using it
EOF if [ $shouldWarn -eq ]; then
cat >& <<-'EOF'
again to update Docker, we urge you to migrate your image store before upgrading
to v1.+. You can find instructions for this here:
https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration
EOF
else
cat >& <<-'EOF'
again to update Docker, you can safely ignore this message.
EOF
fi cat >& <<-'EOF' You may press Ctrl+C now to abort this script.
EOF
( set -x; sleep )
fi user="$(id -un 2>/dev/null || true)" sh_c='sh -c'
if [ "$user" != 'root' ]; then
if command_exists sudo; then
sh_c='sudo -E sh -c'
elif command_exists su; then
sh_c='su -c'
else
cat >& <<-'EOF'
Error: this installer needs the ability to run commands as root.
We are unable to find either "sudo" or "su" available to make this happen.
EOF
exit
fi
fi curl=''
if command_exists curl; then
curl='curl -sSL'
elif command_exists wget; then
curl='wget -qO-'
elif command_exists busybox && busybox --list-modules | grep -q wget; then
curl='busybox wget -qO-'
fi # check to see which repo they are trying to install from
if [ -z "$repo" ]; then
repo='main'
if [ "http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/test/internet" = "$url" ]; then
repo='testing'
then
repo='experimental'
fi
fi # perform some very rudimentary platform detection
lsb_dist=''
dist_version=''
if command_exists lsb_release; then
lsb_dist="$(lsb_release -si)"
fi
if [ -z "$lsb_dist" ] && [ -r /etc/lsb-release ]; then
lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")"
fi
if [ -z "$lsb_dist" ] && [ -r /etc/debian_version ]; then
lsb_dist='debian'
fi
if [ -z "$lsb_dist" ] && [ -r /etc/fedora-release ]; then
lsb_dist='fedora'
fi
if [ -z "$lsb_dist" ] && [ -r /etc/oracle-release ]; then
lsb_dist='oracleserver'
fi
if [ -z "$lsb_dist" ]; then
if [ -r /etc/centos-release ] || [ -r /etc/redhat-release ]; then
lsb_dist='centos'
fi
fi
if [ -z "$lsb_dist" ] && [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")"
fi lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')" case "$lsb_dist" in ubuntu)
if command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then
dist_version="$(. /etc/lsb-release && echo "$DISTRIB_CODENAME")"
fi
;; debian)
dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')"
case "$dist_version" in
)
dist_version="jessie"
;;
)
dist_version="wheezy"
;;
esac
;; oracleserver)
# need to switch lsb_dist to match yum repo URL
lsb_dist="oraclelinux"
ed 's/\..*//' | sed 's/Server*//' | sort -r | head -)"
;; fedora|centos)
ed 's/\..*//' | sed 's/Server*//' | sort -r | head -)"
;; *)
if command_exists lsb_release; then
dist_version="$(lsb_release --codename | cut -f2)"
fi
if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then
dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
fi
;; esac # Check if this is a forked Linux distro
check_forked # Run setup for each distro accordingly
case "$lsb_dist" in
amzn)
(
set -x
$sh_c 'sleep 3; yum -y -q install docker'
)
echo_docker_as_nonroot
exit
;; 'opensuse project'|opensuse)
echo 'Going to perform the following operations:'
if [ "$repo" != 'main' ]; then
echo ' * add repository obs://Virtualization:containers'
fi
echo ' * install Docker'
$sh_c 'echo "Press CTRL-C to abort"; sleep 3' if [ "$repo" != 'main' ]; then
# install experimental packages from OBS://Virtualization:containers
(
set -x
zypper -n ar -f obs://Virtualization:containers Virtualization:containers
rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
)
fi
(
set -x
zypper -n install docker
)
echo_docker_as_nonroot
exit
;;
'suse linux'|sle[sd])
echo 'Going to perform the following operations:'
if [ "$repo" != 'main' ]; then
echo ' * add repository obs://Virtualization:containers'
echo ' * install experimental Docker using packages NOT supported by SUSE'
else
echo ' * add the "Containers" module'
echo ' * install Docker using packages supported by SUSE'
fi
$sh_c 'echo "Press CTRL-C to abort"; sleep 3' if [ "$repo" != 'main' ]; then
# install experimental packages from OBS://Virtualization:containers
by SUSE'
(
set -x
zypper -n ar -f obs://Virtualization:containers/SLE_12 Virtualization:containers
rpm_import_repository_key 55A0B34D49501BB7CA474F5AA193FBB572174FC2
)
else
# Add the containers module
# Note well-: the SLE machine must already be registered against SUSE Customer Center
# Note well-: the `-r ""` is required to workaround a known issue of SUSEConnect
(
set -x
SUSEConnect -p sle-module-containers//x86_64 -r ""
)
fi
(
set -x
zypper -n install docker
)
echo_docker_as_nonroot
exit
;; ubuntu|debian)
export DEBIAN_FRONTEND=noninteractive did_apt_get_update=
apt_get_update() {
if [ -z "$did_apt_get_update" ]; then
( set -x; $sh_c 'sleep 3; apt-get update || true' )
did_apt_get_update=
fi
} # aufs is preferred over devicemapper; try to ensure the driver is available.
if ! grep -q aufs /proc/filesystems && ! $sh_c 'modprobe aufs'; then
/dev/null; then
kern_extras="linux-image-extra-$(uname -r) linux-image-extra-virtual" apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q '"$kern_extras" ) || true if ! grep -q aufs /proc/filesystems && ! $sh_c 'modprobe aufs'; then
echo >& 'Warning: tried to install '"$kern_extras"' (for AUFS)'
!'
( set -x; sleep )
fi
else
echo >& 'Warning: current kernel is not supported by the linux-image-extra-virtual'
echo >& ' package. We have no AUFS support. Consider installing the packages'
echo >& ' linux-image-virtual kernel and linux-image-extra-virtual for AUFS support.'
( set -x; sleep )
fi
fi # install apparmor utils if they're missing and apparmor is enabled in the kernel
# otherwise Docker will fail to start
if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = 'Y' ]; then
if command -v apparmor_parser >/dev/null >&; then
echo 'apparmor is enabled in the kernel and apparmor utils were already installed'
else
echo 'apparmor is enabled in the kernel, but apparmor_parser missing'
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q apparmor' )
fi
fi if [ ! -e /usr/lib/apt/methods/https ]; then
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q apt-transport-https ca-certificates' )
fi
if [ -z "$curl" ]; then
apt_get_update
( set -x; $sh_c 'sleep 3; apt-get install -y -q curl ca-certificates' )
curl='curl -sSL'
fi
(
set -x
for key_server in $key_servers ; do
$sh_c "apt-key adv --keyserver hkp://${key_server}:80 --recv-keys ${gpg_fingerprint}" && break
done
$sh_c "apt-key adv -k ${gpg_fingerprint} >/dev/null"
$sh_c "mkdir -p /etc/apt/sources.list.d"
} > /etc/apt/sources.list.d/docker.list"
ker-engine; else apt-get install -y -q docker-engine=${docker_version}-~ubuntu-${dist_version}; fi"
)
echo_docker_as_nonroot
exit
;; fedora|centos|oraclelinux)
$sh_c "cat >/etc/yum.repos.d/docker-${repo}.repo" <<-EOF
[docker-${repo}-repo]
name=Docker ${repo} Repository
baseurl=${yum_url}/repo/${repo}/${lsb_dist}/${dist_version}
enabled=
gpgcheck=
gpgkey=${yum_url}/gpg
EOF
if [ "$lsb_dist" = "fedora" ] && [ "$dist_version" -ge "" ]; then
(
set -x
$sh_c 'sleep 3; dnf -y -q install docker-engine'
)
else
(
set -x
ll docker-engine; else yum -y -q install docker-engine-$docker_version; fi"
)
fi
echo_docker_as_nonroot
exit
;;
gentoo)
hen
in the output
cat >& <<-'EOF' You appear to be trying to install the latest nightly build in Gentoo.'
The portage tree should contain the latest stable release of Docker, but'
if you want something more recent, you can always use the live ebuild'
provided in the "docker" overlay available via layman. For more'
instructions, please see the following URL:' https://github.com/tianon/docker-overlay#using-this-overlay' After adding the "docker" overlay, you should be able to:' emerge -av =app-emulation/docker-' EOF
exit
fi (
set -x
$sh_c 'sleep 3; emerge app-emulation/docker'
)
exit
;;
esac # intentionally mixed spaces and tabs here -- tabs are stripped by "<<-'EOF'", spaces are kept in the output
cat >& <<-'EOF' Either your platform is not easily detectable, is not supported by this
installer script (yet - PRs welcome! [hack/install.sh]), or does not yet have
a package for Docker. Please visit the following URL for more detailed
installation instructions: https://docs.docker.com/engine/installation/ EOF
exit
} # wrapped up in a function so that we have some protection against only getting
# half the file during "curl | sh"
if [ ! -z $ ] ; then docker_version=$; fi do_install

代码

加速器

#!/bin/sh
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
"registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

  

阿里云安装docker 指定版本的更多相关文章

  1. 阿里云安装docker

    选centos6.5输入操作系统  yum install docker-io docker -d 提示没有备用IP地址可以用来桥接卡 接下来的网卡中编辑eth0 DEVICE=eth0 ONBOOT ...

  2. 彻底卸载干净docker并且安装docker 指定版本

    yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-la ...

  3. 阿里云 安装docker

    转  https://www.jianshu.com/p/f02d63ee98e0

  4. 如何安装NodeJS到阿里云Centos (64位版本V5-7)

    如何安装NodeJS到阿里云Centos (64位版本V5-7) (Centos与Red Hat® Enterprise Linux® / RHEL, Fedora属于一类) 1) 安装v0.10版 ...

  5. rancher说明为什么需要按照指定版本安装以及rancher和节点linux环境配置-docker指定版本安装

    rancher说明为什么需要按照指定版本安装以及rancher和节点linux环境配置-docker指定版本安装 待办 https://blog.csdn.net/CSDN_duomaomao/art ...

  6. 阿里云服务器安装Docker并部署nginx、jdk、redis、mysql

    阿里云服务器安装Docker并部署nginx.jdk.redis.mysql 一.安装Docker 1.安装Docker的依赖库 yum install -y yum-utils device-map ...

  7. 阿里云部署Docker(5)----管理和公布您的镜像

    出到这节,我在百度搜索了一下"阿里云部署Docker",突然发现怎么会有人跟我写的一样呢?哦,原来是其它博客系统的爬虫来抓取,然后也不会写转载自什么什么的.所以,我最终明确为什么那 ...

  8. 阿里云部署Docker(2)

    之前有一篇文章讲过在阿里云中安装Docker,相对来说那个是安装.可是安装完之后我们通常会碰到问题. 今天我给大家记录一下我的新的解决过程. 环境还是ubuntu12.04.如果我们已经把内核升级到了 ...

  9. 阿里云安装Nginx+vue项目部署

    阿里云安装Nginx+vue项目部署 nginx安装包下载 http://nginx.org/en/download.html nginx安装 首先先安装PCRE pcre-devel 和Zlib,因 ...

随机推荐

  1. 三、K3 WISE 开发插件《K3 WISE开发手册》

    1.VB插件工程的命名.命名空间和生成的DLL命名要一致,否则导致注册不成功! 2.主控台的查询分析工具,添加sql直接报表,代码用到临时表,提示“在对应所需名称或序数的集合中未找到项目” 解决:在代 ...

  2. ngnix +tomcat7 简单配置

    1.下载tomcat7 修改conf 文件夹下的server.xml文件 1.<Server port="8205" shutdown="SHUTDOWN" ...

  3. storm事务

    1. storm 事务 对于容错机制,Storm通过一个系统级别的组件acker,结合xor校验机制判断一个msg是否发送成功,进而spout可以重发该msg,保证一个msg在出错的情况下至少被重发一 ...

  4. 利用按钮打开tabBar页面

    场景:当tabBar上有个人中心的时候,这里假设需要登陆才可以看到个人中心A页面,在A页面onload中先判断是否登陆,如果没有登陆就跳转到登陆页面B,待输入用户名和密码,点击登陆按钮后再跳转到A页面 ...

  5. mysqlslap 压测工具使用说明

    PS:今天一同事问我有木有比较靠谱的mysql压力测试工具可用.其实mysql自带就有一个叫mysqlslap的压力测试工具,还是模拟的不错的.下面举例说说.mysqlslap是从5.1.4版开始的一 ...

  6. Unity3D Shader图像扭曲过场效果

    把脚本挂在摄像机上 using UnityEngine; using System.Collections; [RequireComponent(typeof(Camera))] public cla ...

  7. 腾讯微博API时间线相关接口返回的微博信息中head值使用问题

    腾讯微博API时间线相关接口返回的微博信息中head值表示作者头像url,这个链接直接访问并不能使用,需要再附加一个参数指定图片的大小(100.50),比如:[head]/100.

  8. C# AES 加密与解密

    AES 算法加密(ECB模式) 将明文加密,加密后进行base64编码,返回密文 /// <summary> /// AES 算法加密(ECB模式) 将明文加密,加密后进行base64编码 ...

  9. CentOS7.5安装Tomcat8

    一.tomcat的简介 这是Apache Tomcat Servlet / JSP容器的文档包的顶级入口点 .的Apache Tomcat 8.0版实现了Servlet 3.1和JavaServer ...

  10. Python之logging日志模块

    logging 用于便捷既然日志切线程安全的模块 vim log_test.py import logging logging.basicConfig(filename='log.log', form ...