• Stars
    star
    370
  • Rank 115,405 (Top 3 %)
  • Language
    Shell
  • Created about 8 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Scripts for docker-machine to install a particular docker version

install-docker

Scripts for docker-machine to install a particular docker version

Hosted at https://releases.rancher.com/install-docker/x.y[.z].sh, e.g.:

Test bucket is located at https://releases.rancher.com/install-docker-dev/x.y[.z].sh

Currently released versions

install-docker install-docker-dev

Add new docker release

Example adding 20.10.7 with diff from 20.10.6:

  • Run make add-new-version with the previous and new version:
PREVIOUS_ADD_DOCKER_VERSION=20.10.6 ADD_DOCKER_VERSION=20.10.7 make add-new-version
  • Generate distributed script by running make generate
  • Under dist/ create/update the proper docker install script symlink <DOCKER_MAJOR>.<DOCKER_MINOR>.sh, to the generated script. Ex: ln -s 20.10.7.sh 20.10.sh
  • Optional: Run OS tests locally using make test (currently takes around 45 minutes)
  • Commit changes and submit PR (this will start the tests as well)

Test releases

The repo contains some tests to check if the docker install scripts are working fine on defined distros and versions. The tests are executed within a dind env for every pkg/<DOCKER_VERSION> folder, using the generated scripts to install and run docker on defined distros and versions.

make test

There is the default distros and versions definition to test:

TEST_OS_IMAGE_NAME=(ubuntu centos debian)
TEST_OS_IMAGE_TAG[0]="16.04 18.04 20.04"
TEST_OS_IMAGE_TAG[1]="centos7 centos8"
TEST_OS_IMAGE_TAG[2]="10"

The test definition can be overwritten on every docker version folder, using the shell script file pkg/<DOCKER_VERSION>/config.sh

#!/bin/sh

DOCKER_GIT_COMMIT="3d8fe77c2c46c5b7571f94b42793905e5b3e42e4"

TEST_OS_IMAGE_NAME=(ubuntu centos debian)
TEST_OS_IMAGE_TAG[0]="20.04"
TEST_OS_IMAGE_TAG[1]="centos7"
TEST_OS_IMAGE_TAG[2]="10"

Tip As dind test env doesn't use systemd, dockerd is started manually. The default timeout waiting until dockerd starts, is defined by env variable DIND_TEST_WAIT=3s. It can be overwritten on execution time if required, DIND_TEST_WAIT=5s make test

Sync releases

On each merge to master, scripts in dist/ will be uploaded to install-docker-dev bucket and can be retrieved using https://releases.rancher.com/install-docker-dev/$VERSION.sh. The commit of the version that was uploaded can be found on https://releases.rancher.com/install-docker-dev/VERSION

When testing has been completed, a tag can be created to upload the scripts in dist/ to install-docker (https://releases.rancher.com/install-docker/$VERSION.sh). A tag consists of the latest Docker version in the repository (for example, 20.10.12) and epoch timestamp (in case we need to release same set of versions with changes). The tag can be generated using scripts/generate-release-tag, or you can use the GitHub Actions workflow Create release tag directly. The tag of the version that was uploaded can be found on https://releases.rancher.com/install-docker/VERSION

Previous manual instructions to add a new version

This script is based on public docker-install release, https://github.com/docker/docker-install . Docker-install script is built from the docker repo, and it's patched to generate a docker install script for a concrete docker version. The patch is also adding support for oracle and rancheros distros due to not supported on the original script.

To add a new docker installer version, follow these steps:

  • Create a docker version folder under pkg/<DOCKER_VERSION>, version should follow semver format. Ex: pkg/20.10.2/
  • Under docker version folder:
    • Download docker-install version from its repo curl -Lsk http://get.docker.com/ -o <DOCKER_VERSION>.orig.sh and make a copy cp -p <DOCKER_VERSION>.orig.sh <DOCKER_VERSION>.sh
    • Make all the needed changes at <DOCKER_VERSION>.sh. Don't remove SCRIPT_COMMIT_SHA var definition
    • Create diff file, diff -uNr <DOCKER_VERSION>.orig.sh <DOCKER_VERSION>.sh > pkg/<DOCKER_VERSION>/<DOCKER_VERSION>.diff and remove . Ex: pkg/20.10.2/20.10.2.diff
 diff -uNr 20.10.2.orig.sh 20.10.2.sh
--- 20.10.2.orig.sh 2021-01-28 23:47:45.000000000 +0100
+++ 20.10.2.sh  2021-01-28 23:53:21.000000000 +0100
@@ -21,26 +21,11 @@
 # the script was uploaded (Should only be modified by upload job):
 SCRIPT_COMMIT_SHA="3d8fe77c2c46c5b7571f94b42793905e5b3e42e4"
 
-
-# The channel to install from:
-#   * nightly
-#   * test
-#   * stable
-#   * edge (deprecated)
-DEFAULT_CHANNEL_VALUE="stable"
-if [ -z "$CHANNEL" ]; then
- CHANNEL=$DEFAULT_CHANNEL_VALUE
-fi
-
-DEFAULT_DOWNLOAD_URL="https://download.docker.com"
-if [ -z "$DOWNLOAD_URL" ]; then
- DOWNLOAD_URL=$DEFAULT_DOWNLOAD_URL
-fi
-
-DEFAULT_REPO_FILE="docker-ce.repo"
-if [ -z "$REPO_FILE" ]; then
- REPO_FILE="$DEFAULT_REPO_FILE"
-fi
+CHANNEL="stable"
+DOWNLOAD_URL="https://download.docker.com"
+REPO_FILE="docker-ce.repo"
+VERSION=20.10.2
+DIND_TEST_WAIT=${DIND_TEST_WAIT:-3s}  # Wait time until docker start at dind test env
 
 mirror=''
 DRY_RUN=${DRY_RUN:-}
@@ -69,6 +54,18 @@
    ;;
 esac
 
+start_docker() {
+ if [ ! -z $DIND_TEST ]; then
+   # Starting dockerd manually due to dind env is not using systemd
+   dockerd &
+   sleep $DIND_TEST_WAIT
+ elif [ -d '/run/systemd/system' ] ; then
+   $sh_c 'systemctl start docker'
+ else
+   $sh_c 'service docker start'
+ fi
+}
+
 command_exists() {
  command -v "$@" > /dev/null 2>&1
 }
@@ -329,11 +326,20 @@
    ;;
 
    centos|rhel)
+     # installing centos packages
+     lsb_dist="centos"
      if [ -z "$dist_version" ] && [ -r /etc/os-release ]; then
        dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
      fi
    ;;
 
+   oracleserver)
+     # installing centos packages
+     lsb_dist="centos"
+     # need to switch lsb_dist to match yum repo URL
+     dist_version="$(rpm -q --whatprovides redhat-release --queryformat "%{VERSION}\n" | sed 's/\/.*//' | sed 's/\..*//' | sed 's/Server*//')"
+   ;;
+
    *)
      if command_exists lsb_release; then
        dist_version="$(lsb_release --release | cut -f2)"
@@ -404,6 +410,7 @@
          $sh_c "apt-get install -y -qq --no-install-recommends docker-ce-cli=$cli_pkg_version >/dev/null"
        fi
        $sh_c "apt-get install -y -qq --no-install-recommends docker-ce$pkg_version >/dev/null"
+       start_docker
      )
      echo_docker_as_nonroot
      exit 0
@@ -474,10 +481,25 @@
          $sh_c "$pkg_manager install -y -q docker-ce-cli-$cli_pkg_version"
        fi
        $sh_c "$pkg_manager install -y -q docker-ce$pkg_version"
+       if ! command_exists iptables; then
+         $sh_c "$pkg_manager install -y -q iptables"
+       fi
+       start_docker
      )
      echo_docker_as_nonroot
      exit 0
      ;;
+   rancheros)
+     (
+     set -x
+     $sh_c "sleep 3;ros engine list --update"
+     engine_version="$(sudo ros engine list | awk '{print $2}' | grep ${docker_version} | tail -n 1)"
+     if [ "$engine_version" != "" ]; then
+       $sh_c "ros engine switch -f $engine_version"
+     fi
+     )
+     exit 0
+     ;;
    *)
      if [ -z "$lsb_dist" ]; then
        if is_darwin; then

  • Create shell script file pkg/<DOCKER_VERSION>/config.sh. To assure the patch would be applied to the same origin script version, this file should contain DOCKER_GIT_COMMIT var equal to SCRIPT_COMMIT_SHA got on first steps. Ex: pkg/20.10.2/config.sh
#!/bin/sh

DOCKER_GIT_COMMIT="3d8fe77c2c46c5b7571f94b42793905e5b3e42e4"
  • Generate the docker version install script dist/<DOCKER_VERSION>.sh executing make generate. This command will generate docker version install script for every pkg/<DOCKER_VERSION> folder, if it doesn't exist and pkg/<DOCKER_VERSION>/<DOCKER_VERSION>.diff and pkg/<DOCKER_VERSION>/config.sh files exist. This command will also shows an info message for docker install scripts that were generated with older DOCKER_GIT_COMMIT, so they could be updated with latest released DOCKER_GIT_COMMIT. git and curl commands are required. Ex: Will generate dist/20.10.2.sh.
  • Under dist/ create/update the proper docker install script symlink <DOCKER_MAJOR>.<DOCKER_MINOR>.sh, to the generated script. Ex: ln -s 20.10.2.sh 20.10.sh
  • Define and execute tests, make test. See above for more info
  • Commit changes and submit PR

More Repositories

1

rancher

Complete container management platform
Go
23,193
star
2

os

Tiny Linux distro that runs the entire OS as Docker containers
Go
6,437
star
3

k3os

Purpose-built OS for Kubernetes, fully managed by Kubernetes.
Go
3,403
star
4

rke

Rancher Kubernetes Engine (RKE), an extremely simple, lightning fast Kubernetes distribution that runs entirely within containers.
Go
3,197
star
5

rio

Application Deployment Engine for Kubernetes
Go
2,282
star
6

local-path-provisioner

Dynamically provisioning persistent local storage with Kubernetes
Go
2,138
star
7

fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
Go
1,514
star
8

convoy

A Docker volume plugin, managing persistent container volumes.
Go
1,308
star
9

rke2

Go
1,028
star
10

old-vm

(OBSOLETE) Package and Run Virtual Machines as Docker Containers
Go
646
star
11

ui

Rancher UI
JavaScript
598
star
12

cattle

Infrastructure orchestration engine for Rancher 1.x
Java
574
star
13

k3c

Lightweight local container engine for container development
Go
571
star
14

system-upgrade-controller

In your Kubernetes, upgrading your nodes
Go
502
star
15

dashboard

The Rancher UI
Vue
449
star
16

charts

Github based Helm Chart Index Repository providing charts crafted for Rancher Manager
Smarty
389
star
17

community-catalog

Catalog entries contributed by the community
Smarty
384
star
18

dapper

Docker build wrapper
Go
358
star
19

quickstart

HCL
357
star
20

terraform-provider-rke

Terraform provider plugin for deploy kubernetes cluster by RKE(Rancher Kubernetes Engine)
Go
340
star
21

opni

Multi Cluster Observability with AIOps
Go
334
star
22

cli

Rancher CLI
Go
331
star
23

kim

In ur kubernetes, buildin ur imagez
Go
326
star
24

trash

Minimalistic Go vendored code manager
Go
296
star
25

elemental

Elemental is an immutable Linux distribution built to run Rancher and its corresponding Kubernetes distributions RKE2 and k3s. It is built using the Elemental-toolkit
Go
295
star
26

terraform-controller

Use K8s to Run Terraform
Go
292
star
27

elemental-toolkit

❄️ The toolkit to build, ship and maintain cloud-init driven Linux derivatives based on container images
Go
272
star
28

remotedialer

HTTP in TCP in Websockets in HTTP in TCP, Tunnel all the things!
Go
255
star
29

terraform-provider-rancher2

Terraform Rancher2 provider
Go
222
star
30

rancher-compose

Docker compose compatible client to deploy to Rancher
Go
214
star
31

wrangler

Write controllers like a boss
Go
205
star
32

os-vagrant

Ruby
176
star
33

k3k

Kubernetes in Kubernetes
Go
163
star
34

rancher-cleanup

Shell
160
star
35

rancher-catalog

Smarty
155
star
36

docs

Documentation for Rancher products (for 2.0/new site)
SCSS
140
star
37

fleet-examples

Fleet usage examples
Shell
140
star
38

catalog-dockerfiles

Dockerfiles for Rancher Catalog containers
Shell
131
star
39

api-spec

Specification for Rancher REST API implementation
121
star
40

k8s-intro-training

HTML
114
star
41

ansible-playbooks

Rancher 1.6 Installation. Doesn't support Rancher 2.0
Python
113
star
42

sherdock

Docker Image Manager
JavaScript
110
star
43

norman

APIs on APIs on APIs
Go
108
star
44

docker-from-scratch

Tiny Docker in Docker
Go
105
star
45

backup-restore-operator

Go
99
star
46

lb-controller

Load Balancer for Rancher services via ingress controllers backed up by a Load Balancer provider of choice
Go
97
star
47

pipeline

Go
96
star
48

container-crontab

Simple cron runner for containers
Go
88
star
49

terraform-modules

Rancher Terraform Modules
HCL
85
star
50

system-charts

Replaced by rancher/charts. The deprecation process is in progress.
Mustache
84
star
51

os2

EXPERIMENTAL: A Rancher and Kubernetes optimized immutable Linux distribution based on openSUSE
Go
82
star
52

cluster-api-provider-rke2

RKE2 bootstrap and control-plane Cluster API providers.
Go
81
star
53

vagrant

Vagrant file to stand up a Local Rancher install with 3 nodes
Shell
79
star
54

rancher-dns

A simple DNS server that returns different answers depending on the IP address of the client making the request
Go
79
star
55

giddyup

Go
78
star
56

kontainer-engine

Provisioning kubernetes cluster at ease
Go
78
star
57

go-rancher

Go language bindings for Rancher API
Go
74
star
58

go-skel

Skeleton for Rancher Go Microservices
Shell
71
star
59

runc-cve

CVE patches for legacy runc packaged with Docker
Dockerfile
69
star
60

terraform-k3s-aws-cluster

HCL
67
star
61

agent

Shell
64
star
62

kontainer-driver-metadata

This repository is to keep information of k8s versions and their dependencies like k8s components flags and system addons images.
Go
63
star
63

external-dns

Service updating external DNS with Rancher services records for Rancher 1.6
Go
63
star
64

terraform-provider-rancher2-archive

[Deprecated] Use https://github.com/terraform-providers/terraform-provider-rancher2
Go
62
star
65

gitjob

Go
59
star
66

types

Rancher API types
Go
59
star
67

rancher-docs

Rancher Documentation
JavaScript
58
star
68

rancher.github.io

HTML
58
star
69

ui-driver-skel

Skeleton Rancher UI driver for custom docker-machine drivers
JavaScript
58
star
70

rke2-charts

Shell
56
star
71

os-services

RancherOS Service Compose Templates
Shell
54
star
72

turtles

Rancher CAPI extension
Go
50
star
73

client-python

A Python client for Rancher APIs
Python
49
star
74

hyperkube

Rancher hyperkube images
48
star
75

partner-charts

A catalog based on applications from independent software vendors (ISVs). Most of them are SUSE Partners.
Smarty
47
star
76

rancher-cloud-controller-manager

A kubernetes cloud-controller-manager for the rancher cloud
Go
44
star
77

steve

Kubernetes API Translator
Go
43
star
78

rodeo

Smarty
43
star
79

cluster-template-examples

43
star
80

cis-operator

Go
43
star
81

rancherd

Bootstrap Rancher and k3s/rke2
Go
42
star
82

10acre-ranch

Build Rancher environment on GCE
Shell
41
star
83

elemental-operator

The Elemental operator is responsible for managing the OS versions and maintaining a machine inventory to assist with edge or baremetal installations.
Go
41
star
84

secrets-bridge

Go
40
star
85

storage

Rancher specific storage plugins
Shell
39
star
86

k8s-sql

Storage backend for Kubernetes using Go database/sql
Go
37
star
87

lasso

Low level generic controller framework
Go
36
star
88

server-chart

[Deprecated] Helm chart for Rancher server
Shell
36
star
89

os-packer

Shell
36
star
90

pipeline-example-go

Go
36
star
91

system-tools

This repo is for tools helping with various cleanup tasks for rancher projects. Example: rancher installation cleanup
Go
35
star
92

rancher-metadata

A simple HTTP server that returns EC2-style metadata information that varies depending on the source IP address making the request.
Go
31
star
93

os-base

Base file system for RancherOS images
Shell
31
star
94

image-mirror

Shell
31
star
95

websocket-proxy

Go
29
star
96

rke-tools

Tools container for supporting functions in RKE
Go
29
star
97

gdapi-python

Python Binding to API spec
Python
28
star
98

wins

Windows containers connect to Windows host
Go
28
star
99

api-ui

Embedded UI for any service that implements the Rancher API spec
JavaScript
27
star
100

migration-tools

Go
27
star