阿里云安装docker 指定版本
- 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 指定版本的更多相关文章
- 阿里云安装docker
选centos6.5输入操作系统 yum install docker-io docker -d 提示没有备用IP地址可以用来桥接卡 接下来的网卡中编辑eth0 DEVICE=eth0 ONBOOT ...
- 彻底卸载干净docker并且安装docker 指定版本
yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-la ...
- 阿里云 安装docker
转 https://www.jianshu.com/p/f02d63ee98e0
- 如何安装NodeJS到阿里云Centos (64位版本V5-7)
如何安装NodeJS到阿里云Centos (64位版本V5-7) (Centos与Red Hat® Enterprise Linux® / RHEL, Fedora属于一类) 1) 安装v0.10版 ...
- rancher说明为什么需要按照指定版本安装以及rancher和节点linux环境配置-docker指定版本安装
rancher说明为什么需要按照指定版本安装以及rancher和节点linux环境配置-docker指定版本安装 待办 https://blog.csdn.net/CSDN_duomaomao/art ...
- 阿里云服务器安装Docker并部署nginx、jdk、redis、mysql
阿里云服务器安装Docker并部署nginx.jdk.redis.mysql 一.安装Docker 1.安装Docker的依赖库 yum install -y yum-utils device-map ...
- 阿里云部署Docker(5)----管理和公布您的镜像
出到这节,我在百度搜索了一下"阿里云部署Docker",突然发现怎么会有人跟我写的一样呢?哦,原来是其它博客系统的爬虫来抓取,然后也不会写转载自什么什么的.所以,我最终明确为什么那 ...
- 阿里云部署Docker(2)
之前有一篇文章讲过在阿里云中安装Docker,相对来说那个是安装.可是安装完之后我们通常会碰到问题. 今天我给大家记录一下我的新的解决过程. 环境还是ubuntu12.04.如果我们已经把内核升级到了 ...
- 阿里云安装Nginx+vue项目部署
阿里云安装Nginx+vue项目部署 nginx安装包下载 http://nginx.org/en/download.html nginx安装 首先先安装PCRE pcre-devel 和Zlib,因 ...
随机推荐
- 决策树归纳算法之ID3
学习是一个循序渐进的过程,我们首先来认识一下,什么是决策树.顾名思义,决策树就是拿来对一个事物做决策,作判断.那如何判断呢?凭什么判断呢?都是值得我们去思考的问题. 请看以下两个简单例子: 第一个例子 ...
- sea.js常用接口
seajs.config 用来对 Sea.js 进行配置. seajs.config({ // 指定需要使用的插件 plugins: ['text', 'shim'], // 设置别名,方便调用 al ...
- ASP.NET使用百度编辑器(UEditor)使用方法
ASP.NET使用百度编辑器(UEditor)方法如下 第一步到百度官网下载百度编辑器 http://ueditor.baidu.com/website/download.html 下载.net版本 ...
- JSON类库 Flexjson学习
官方地址(需FQ):http://flexjson.sourceforge.net/ Flexjson 是一个将 Java 对象转成 JSON 的 类库,是一个深度转换的过程. 下面是我写的一个例子: ...
- 题目1459:Prime ring problem(素数环问题——递归算法)
题目链接:http://ac.jobdu.com/problem.php?pid=1459 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...
- 第二步 (仅供参考) sencha touch + PhoneGap(cordova 2.9 及其以下版本) 使用 adt eclipse进行打包
首先你得安装一个adt-eclipse 参考资料 http://www.crifan.com/android_eclipse_offline_install_adt/ 然后就可以运行adt-eclip ...
- Sphinx以及coreseek的安装及使用
检索结构 php -> sphinx -> mysql 非结构化数据又叫全文数据,非固定长度字段例如文章标题搜索这类适用sphinx 全文数据搜索: 1 顺序扫描 : 如like查找 2 ...
- apktool反解apk包
APKTool APKTOOL是解包 APK 文件最常用的工具,许多 APK 工具箱都集成了 apktool.它可以完整解包 APK,解包后你可以看到 APK 里面的声明文件.布局文件.图片资源文件. ...
- 23种设计模式之抽象工厂(Abstract Factory)
抽象工厂模式又称为Kit模式,属于对象创建型模式.抽象工厂模式是所有形式的工厂模式中最为抽象和最具一般性的一种形态,它提供了一个创建一系列相关或相互依赖对象的接口,而无需指定它们具体的类.在抽象工厂模 ...
- iOS中self.xxx 和 _xxx 下划线的区别
property (nonatomic,copy) NSString *propertyName; self.propertyName 是对属性的拜访: _propertyName 是对部分变量的拜访 ...