Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tools/install_docker #2125

Merged
merged 5 commits into from
Nov 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- checkout
- run:
name: Update docker
command: ./tools/ci/docker_update
command: sudo apt-get update && sudo ./tools/install_docker
- run:
name: Pull and tag scion_base image
command: ./tools/ci/prepare_image d1706fb3c9c8eacdc9a91ddeac7c3ac1ad815fe43fc81bd50a280b3738ce7569
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
- checkout
- run:
name: Update docker
command: ./tools/ci/docker_update
command: sudo apt-get update && sudo ./tools/install_docker
- run:
name: Build base
command: ./docker.sh base
Expand Down
21 changes: 0 additions & 21 deletions tools/ci/docker_update

This file was deleted.

47 changes: 31 additions & 16 deletions tools/install_docker
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
#!/bin/bash

set -ex
set -e

# Update docker-compose to 1.22.0
[ $(id -u) -eq 0 ] || { echo "Error: this script should be run as root" && exit 1; }

# Install prereqs
DEBIAN_FRONTEND=noninteractive apt-get install -y apt-transport-https ca-certificates curl lsb-release software-properties-common

chksum() {
echo "${1:?} ${2:?}" | sha256sum --status -c -
}

# Install docker-compose 1.22.0
case "$(uname -m)" in
x86_64)
src=https://github.com/docker/compose/releases/download/1.22.0/docker-compose-Linux-x86_64
Expand All @@ -13,19 +22,25 @@ case "$(uname -m)" in
echo "ERROR: unsupported architecture '$(uname -m)'"
exit 1
esac
curl -L "$src" -o "$file"
echo "$sum $file" | sha256sum -c -
# If the file doesn't exist, or the checksum fails, (re)download it.
if [ ! -e "$file" ] || ! chksum $sum $file; then
curl -sSL "$src" -o "$file"
chksum $sum $file || { echo "Error: $file doesn't match the expected checksum. ($sum)"; exit 1; }
fi
chmod +x "$file"

# Install Docker dependencies
apt-get update
apt-get install apt-transport-https ca-certificates curl software-properties-common iproute2 -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"

# Install docker to 18.06
apt-get update && apt-get install docker-ce=18.06* -y
if [ "$(lsb_release -is)" == "LinuxMint" ]; then
release=$(grep UBUNTU_CODENAME /etc/os-release | cut -f2 -d=)
fi
release=${release:-$(lsb_release -cs)}

# Add docker apt repo.
if ! grep -Rq "https://download.docker.com/linux/ubuntu" /etc/apt/sources.list.d/; then
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/ubuntu $release stable"
apt-get update
fi

# Install docker-ce
DEBIAN_FRONTEND=noninteractive apt-get install -y docker-ce=18.06*
echo 'docker-ce hold' | dpkg --set-selections