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