github.com/jiasir/docker@v1.3.3-0.20170609024000-252e610103e7/hack/install.sh (about) 1 #!/bin/sh 2 set -e 3 # 4 # This script is meant for quick & easy install via: 5 # 'curl -sSL https://get.docker.com/ | sh' 6 # or: 7 # 'wget -qO- https://get.docker.com/ | sh' 8 # 9 # For test builds (ie. release candidates): 10 # 'curl -fsSL https://test.docker.com/ | sh' 11 # or: 12 # 'wget -qO- https://test.docker.com/ | sh' 13 # 14 # For experimental builds: 15 # 'curl -fsSL https://experimental.docker.com/ | sh' 16 # or: 17 # 'wget -qO- https://experimental.docker.com/ | sh' 18 # 19 # Docker Maintainers: 20 # To update this script on https://get.docker.com, 21 # use hack/release.sh during a normal release, 22 # or the following one-liner for script hotfixes: 23 # aws s3 cp --acl public-read hack/install.sh s3://get.docker.com/index 24 # 25 26 url="https://get.docker.com/" 27 apt_url="https://apt.dockerproject.org" 28 yum_url="https://yum.dockerproject.org" 29 30 docker_key="-----BEGIN PGP PUBLIC KEY BLOCK----- 31 Version: GnuPG v1 32 33 mQINBFWln24BEADrBl5p99uKh8+rpvqJ48u4eTtjeXAWbslJotmC/CakbNSqOb9o 34 ddfzRvGVeJVERt/Q/mlvEqgnyTQy+e6oEYN2Y2kqXceUhXagThnqCoxcEJ3+KM4R 35 mYdoe/BJ/J/6rHOjq7Omk24z2qB3RU1uAv57iY5VGw5p45uZB4C4pNNsBJXoCvPn 36 TGAs/7IrekFZDDgVraPx/hdiwopQ8NltSfZCyu/jPpWFK28TR8yfVlzYFwibj5WK 37 dHM7ZTqlA1tHIG+agyPf3Rae0jPMsHR6q+arXVwMccyOi+ULU0z8mHUJ3iEMIrpT 38 X+80KaN/ZjibfsBOCjcfiJSB/acn4nxQQgNZigna32velafhQivsNREFeJpzENiG 39 HOoyC6qVeOgKrRiKxzymj0FIMLru/iFF5pSWcBQB7PYlt8J0G80lAcPr6VCiN+4c 40 NKv03SdvA69dCOj79PuO9IIvQsJXsSq96HB+TeEmmL+xSdpGtGdCJHHM1fDeCqkZ 41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660jglyshch6CWeiUATqjIAzkEQom/kEnOrvJAtkypRJ59vYQOedZ1s 90 FVELMXg2UCkD/FwojfnVtjzYaTCeGwFQeqzHmM241iuOmBYPeyTY5veF49aBJA1g 91 EJOQTvBR8Q== 92 =Yhur 93 -----END PGP PUBLIC KEY BLOCK----- 94 " 95 96 mirror='' 97 while [ $# -gt 0 ]; do 98 case "$1" in 99 --mirror) 100 mirror="$2" 101 shift 102 ;; 103 *) 104 echo "Illegal option $1" 105 ;; 106 esac 107 shift $(( $# > 0 ? 1 : 0 )) 108 done 109 110 case "$mirror" in 111 AzureChinaCloud) 112 apt_url="https://mirror.azure.cn/docker-engine/apt" 113 yum_url="https://mirror.azure.cn/docker-engine/yum" 114 ;; 115 Aliyun) 116 apt_url="https://mirrors.aliyun.com/docker-engine/apt" 117 yum_url="https://mirrors.aliyun.com/docker-engine/yum" 118 ;; 119 esac 120 121 command_exists() { 122 command -v "$@" > /dev/null 2>&1 123 } 124 125 echo_docker_as_nonroot() { 126 if command_exists docker && [ -e /var/run/docker.sock ]; then 127 ( 128 set -x 129 $sh_c 'docker version' 130 ) || true 131 fi 132 your_user=your-user 133 [ "$user" != 'root' ] && your_user="$user" 134 # intentionally mixed spaces and tabs here -- tabs are stripped by "<<-EOF", spaces are kept in the output 135 cat <<-EOF 136 137 If you would like to use Docker as a non-root user, you should now consider 138 adding your user to the "docker" group with something like: 139 140 sudo usermod -aG docker $your_user 141 142 Remember that you will have to log out and back in for this to take effect! 143 144 WARNING: Adding a user to the "docker" group will grant the ability to run 145 containers which can be used to obtain root privileges on the 146 docker host. 147 Refer to https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface 148 for more information. 149 150 EOF 151 } 152 153 # Check if this is a forked Linux distro 154 check_forked() { 155 156 # Check for lsb_release command existence, it usually exists in forked distros 157 if command_exists lsb_release; then 158 # Check if the `-u` option is supported 159 set +e 160 lsb_release -a -u > /dev/null 2>&1 161 lsb_release_exit_code=$? 162 set -e 163 164 # Check if the command has exited successfully, it means we're in a forked distro 165 if [ "$lsb_release_exit_code" = "0" ]; then 166 # Print info about current distro 167 cat <<-EOF 168 You're using '$lsb_dist' version '$dist_version'. 169 EOF 170 171 # Get the upstream release info 172 lsb_dist=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'id' | cut -d ':' -f 2 | tr -d '[[:space:]]') 173 dist_version=$(lsb_release -a -u 2>&1 | tr '[:upper:]' '[:lower:]' | grep -E 'codename' | cut -d ':' -f 2 | tr -d '[[:space:]]') 174 175 # Print info about upstream distro 176 cat <<-EOF 177 Upstream release is '$lsb_dist' version '$dist_version'. 178 EOF 179 else 180 if [ -r /etc/debian_version ] && [ "$lsb_dist" != "ubuntu" ] && [ "$lsb_dist" != "raspbian" ]; then 181 # We're Debian and don't even know it! 182 lsb_dist=debian 183 dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')" 184 case "$dist_version" in 185 9) 186 dist_version="stretch" 187 ;; 188 8|'Kali Linux 2') 189 dist_version="jessie" 190 ;; 191 7) 192 dist_version="wheezy" 193 ;; 194 esac 195 fi 196 fi 197 fi 198 } 199 200 semverParse() { 201 major="${1%%.*}" 202 minor="${1#$major.}" 203 minor="${minor%%.*}" 204 patch="${1#$major.$minor.}" 205 patch="${patch%%[-.]*}" 206 } 207 208 do_install() { 209 architecture=$(uname -m) 210 case $architecture in 211 # officially supported 212 amd64|x86_64) 213 ;; 214 # unofficially supported with available repositories 215 armv6l|armv7l) 216 ;; 217 # unofficially supported without available repositories 218 aarch64|arm64|ppc64le|s390x) 219 cat 1>&2 <<-EOF 220 Error: This install script does not support $architecture, because no 221 $architecture package exists in Docker's repositories. 222 223 Other install options include checking your distribution's package repository 224 for a version of Docker, or building Docker from source. 225 EOF 226 exit 1 227 ;; 228 # not supported 229 *) 230 cat >&2 <<-EOF 231 Error: $architecture is not a recognized platform. 232 EOF 233 exit 1 234 ;; 235 esac 236 237 if command_exists docker; then 238 version="$(docker -v | cut -d ' ' -f3 | cut -d ',' -f1)" 239 MAJOR_W=1 240 MINOR_W=10 241 242 semverParse $version 243 244 shouldWarn=0 245 if [ $major -lt $MAJOR_W ]; then 246 shouldWarn=1 247 fi 248 249 if [ $major -le $MAJOR_W ] && [ $minor -lt $MINOR_W ]; then 250 shouldWarn=1 251 fi 252 253 cat >&2 <<-'EOF' 254 Warning: the "docker" command appears to already exist on this system. 255 256 If you already have Docker installed, this script can cause trouble, which is 257 why we're displaying this warning and provide the opportunity to cancel the 258 installation. 259 260 If you installed the current Docker package using this script and are using it 261 EOF 262 263 if [ $shouldWarn -eq 1 ]; then 264 cat >&2 <<-'EOF' 265 again to update Docker, we urge you to migrate your image store before upgrading 266 to v1.10+. 267 268 You can find instructions for this here: 269 https://github.com/docker/docker/wiki/Engine-v1.10.0-content-addressability-migration 270 EOF 271 else 272 cat >&2 <<-'EOF' 273 again to update Docker, you can safely ignore this message. 274 EOF 275 fi 276 277 cat >&2 <<-'EOF' 278 279 You may press Ctrl+C now to abort this script. 280 EOF 281 ( set -x; sleep 20 ) 282 fi 283 284 user="$(id -un 2>/dev/null || true)" 285 286 sh_c='sh -c' 287 if [ "$user" != 'root' ]; then 288 if command_exists sudo; then 289 sh_c='sudo -E sh -c' 290 elif command_exists su; then 291 sh_c='su -c' 292 else 293 cat >&2 <<-'EOF' 294 Error: this installer needs the ability to run commands as root. 295 We are unable to find either "sudo" or "su" available to make this happen. 296 EOF 297 exit 1 298 fi 299 fi 300 301 curl='' 302 if command_exists curl; then 303 curl='curl -sSL' 304 elif command_exists wget; then 305 curl='wget -qO-' 306 elif command_exists busybox && busybox --list-modules | grep -q wget; then 307 curl='busybox wget -qO-' 308 fi 309 310 # check to see which repo they are trying to install from 311 if [ -z "$repo" ]; then 312 repo='main' 313 if [ "https://test.docker.com/" = "$url" ]; then 314 repo='testing' 315 elif [ "https://experimental.docker.com/" = "$url" ]; then 316 repo='experimental' 317 fi 318 fi 319 320 # perform some very rudimentary platform detection 321 lsb_dist='' 322 dist_version='' 323 if command_exists lsb_release; then 324 lsb_dist="$(lsb_release -si)" 325 fi 326 if [ -z "$lsb_dist" ] && [ -r /etc/lsb-release ]; then 327 lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")" 328 fi 329 if [ -z "$lsb_dist" ] && [ -r /etc/debian_version ]; then 330 lsb_dist='debian' 331 fi 332 if [ -z "$lsb_dist" ] && [ -r /etc/fedora-release ]; then 333 lsb_dist='fedora' 334 fi 335 if [ -z "$lsb_dist" ] && [ -r /etc/oracle-release ]; then 336 lsb_dist='oracleserver' 337 fi 338 if [ -z "$lsb_dist" ] && [ -r /etc/centos-release ]; then 339 lsb_dist='centos' 340 fi 341 if [ -z "$lsb_dist" ] && [ -r /etc/redhat-release ]; then 342 lsb_dist='redhat' 343 fi 344 if [ -z "$lsb_dist" ] && [ -r /etc/photon-release ]; then 345 lsb_dist='photon' 346 fi 347 if [ -z "$lsb_dist" ] && [ -r /etc/os-release ]; then 348 lsb_dist="$(. /etc/os-release && echo "$ID")" 349 fi 350 351 lsb_dist="$(echo "$lsb_dist" | tr '[:upper:]' '[:lower:]')" 352 353 # Special case redhatenterpriseserver 354 if [ "${lsb_dist}" = "redhatenterpriseserver" ]; then 355 # Set it to redhat, it will be changed to centos below anyways 356 lsb_dist='redhat' 357 fi 358 359 case "$lsb_dist" in 360 361 ubuntu) 362 if command_exists lsb_release; then 363 dist_version="$(lsb_release --codename | cut -f2)" 364 fi 365 if [ -z "$dist_version" ] && [ -r /etc/lsb-release ]; then 366 dist_version="$(. /etc/lsb-release && echo "$DISTRIB_CODENAME")" 367 fi 368 ;; 369 370 debian|raspbian) 371 dist_version="$(cat /etc/debian_version | sed 's/\/.*//' | sed 's/\..*//')" 372 case "$dist_version" in 373 9) 374 dist_version="stretch" 375 ;; 376 8) 377 dist_version="jessie" 378 ;; 379 7) 380 dist_version="wheezy" 381 ;; 382 esac 383 ;; 384 385 oracleserver) 386 # need to switch lsb_dist to match yum repo URL 387 lsb_dist="oraclelinux" 388 dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//' | sed 's/Server*//')" 389 ;; 390 391 fedora|centos|redhat) 392 dist_version="$(rpm -q --whatprovides ${lsb_dist}-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//' | sed 's/Server*//' | sort | tail -1)" 393 ;; 394 395 "vmware photon") 396 lsb_dist="photon" 397 dist_version="$(. /etc/os-release && echo "$VERSION_ID")" 398 ;; 399 400 *) 401 if command_exists lsb_release; then 402 dist_version="$(lsb_release --codename | cut -f2)" 403 fi 404 if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then 405 dist_version="$(. /etc/os-release && echo "$VERSION_ID")" 406 fi 407 ;; 408 409 410 esac 411 412 # Check if this is a forked Linux distro 413 check_forked 414 415 # Run setup for each distro accordingly 416 case "$lsb_dist" in 417 ubuntu|debian|raspbian) 418 export DEBIAN_FRONTEND=noninteractive 419 420 did_apt_get_update= 421 apt_get_update() { 422 if [ -z "$did_apt_get_update" ]; then 423 ( set -x; $sh_c 'sleep 3; apt-get update' ) 424 did_apt_get_update=1 425 fi 426 } 427 428 if [ "$lsb_dist" != "raspbian" ]; then 429 # aufs is preferred over devicemapper; try to ensure the driver is available. 430 if ! grep -q aufs /proc/filesystems && ! $sh_c 'modprobe aufs'; then 431 if uname -r | grep -q -- '-generic' && dpkg -l 'linux-image-*-generic' | grep -qE '^ii|^hi' 2>/dev/null; then 432 kern_extras="linux-image-extra-$(uname -r) linux-image-extra-virtual" 433 434 apt_get_update 435 ( set -x; $sh_c 'sleep 3; apt-get install -y -q '"$kern_extras" ) || true 436 437 if ! grep -q aufs /proc/filesystems && ! $sh_c 'modprobe aufs'; then 438 echo >&2 'Warning: tried to install '"$kern_extras"' (for AUFS)' 439 echo >&2 ' but we still have no AUFS. Docker may not work. Proceeding anyways!' 440 ( set -x; sleep 10 ) 441 fi 442 else 443 echo >&2 'Warning: current kernel is not supported by the linux-image-extra-virtual' 444 echo >&2 ' package. We have no AUFS support. Consider installing the packages' 445 echo >&2 ' "linux-image-virtual" and "linux-image-extra-virtual" for AUFS support.' 446 ( set -x; sleep 10 ) 447 fi 448 fi 449 fi 450 451 # install apparmor utils if they're missing and apparmor is enabled in the kernel 452 # otherwise Docker will fail to start 453 if [ "$(cat /sys/module/apparmor/parameters/enabled 2>/dev/null)" = 'Y' ]; then 454 if command -v apparmor_parser >/dev/null 2>&1; then 455 echo 'apparmor is enabled in the kernel and apparmor utils were already installed' 456 else 457 echo 'apparmor is enabled in the kernel, but apparmor_parser is missing. Trying to install it..' 458 apt_get_update 459 ( set -x; $sh_c 'sleep 3; apt-get install -y -q apparmor' ) 460 fi 461 fi 462 463 if [ ! -e /usr/lib/apt/methods/https ]; then 464 apt_get_update 465 ( set -x; $sh_c 'sleep 3; apt-get install -y -q apt-transport-https ca-certificates' ) 466 fi 467 if [ -z "$curl" ]; then 468 apt_get_update 469 ( set -x; $sh_c 'sleep 3; apt-get install -y -q curl ca-certificates' ) 470 curl='curl -sSL' 471 fi 472 if ! command -v gpg > /dev/null; then 473 apt_get_update 474 ( set -x; $sh_c 'sleep 3; apt-get install -y -q gnupg2 || apt-get install -y -q gnupg' ) 475 fi 476 477 # dirmngr is a separate package in ubuntu yakkety; see https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1634464 478 if ! command -v dirmngr > /dev/null; then 479 apt_get_update 480 ( set -x; $sh_c 'sleep 3; apt-get install -y -q dirmngr' ) 481 fi 482 483 ( 484 set -x 485 echo "$docker_key" | $sh_c 'apt-key add -' 486 $sh_c "mkdir -p /etc/apt/sources.list.d" 487 $sh_c "echo deb \[arch=$(dpkg --print-architecture)\] ${apt_url}/repo ${lsb_dist}-${dist_version} ${repo} > /etc/apt/sources.list.d/docker.list" 488 $sh_c 'sleep 3; apt-get update; apt-get install -y -q docker-engine' 489 ) 490 echo_docker_as_nonroot 491 exit 0 492 ;; 493 494 fedora|centos|redhat|oraclelinux|photon) 495 if [ "${lsb_dist}" = "redhat" ]; then 496 # we use the centos repository for both redhat and centos releases 497 lsb_dist='centos' 498 fi 499 $sh_c "cat >/etc/yum.repos.d/docker-${repo}.repo" <<-EOF 500 [docker-${repo}-repo] 501 name=Docker ${repo} Repository 502 baseurl=${yum_url}/repo/${repo}/${lsb_dist}/${dist_version} 503 enabled=1 504 gpgcheck=1 505 gpgkey=${yum_url}/gpg 506 EOF 507 if [ "$lsb_dist" = "fedora" ] && [ "$dist_version" -ge "22" ]; then 508 ( 509 set -x 510 $sh_c 'sleep 3; dnf -y -q install docker-engine' 511 ) 512 elif [ "$lsb_dist" = "photon" ]; then 513 ( 514 set -x 515 $sh_c 'sleep 3; tdnf -y install docker-engine' 516 ) 517 else 518 ( 519 set -x 520 $sh_c 'sleep 3; yum -y -q install docker-engine' 521 ) 522 fi 523 echo_docker_as_nonroot 524 exit 0 525 ;; 526 esac 527 528 # intentionally mixed spaces and tabs here -- tabs are stripped by "<<-'EOF'", spaces are kept in the output 529 cat >&2 <<-'EOF' 530 531 Either your platform is not easily detectable, is not supported by this 532 installer script (yet - PRs welcome! [hack/install.sh]), or does not yet have 533 a package for Docker. Please visit the following URL for more detailed 534 installation instructions: 535 536 https://docs.docker.com/engine/installation/ 537 538 EOF 539 exit 1 540 } 541 542 # wrapped up in a function so that we have some protection against only getting 543 # half the file during "curl | sh" 544 do_install