File: install_docker.sh

package info (click to toggle)
ruby-docker-api 2.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 432 kB
  • sloc: ruby: 4,044; sh: 138; makefile: 5
file content (44 lines) | stat: -rwxr-xr-x 969 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -ex

declare -a SEMVER

# argv[0]
DOCKER_VERSION=$1
# argv[1]
DOCKER_CE=$2

# disable travis default installation
systemctl stop docker.service
apt-get -y --purge remove docker docker-engine docker.io containerd runc

# install gpg key for docker rpo
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
apt-key fingerprint 0EBFCD88

# enable docker repo
add-apt-repository \
  "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) \
  stable"
apt-get update
apt-cache gencaches

set +e
# install package
apt-get install docker-ce=${DOCKER_VERSION}

if [ $? -ne 0 ]; then
  echo "Error: Could not install ${DOCKER_VERSION}"
  echo "Available docker versions:"
  apt-cache madison docker-ce
  exit 1
fi
set -e

systemctl stop docker.service

echo 'DOCKER_OPTS="-H unix:///var/run/docker.sock --pidfile=/var/run/docker.pid"' > /etc/default/docker
cat /etc/default/docker

systemctl start docker.service