Correcting license and copyright terms throughout the repo
[fuel.git] / build / docker / ubuntu-builder / install_docker.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 # From prepare-build-env.sh of Fuel
12 # Check if docker is installed
13 if hash docker 2>/dev/null; then
14   echo "Docker binary found, checking if service is running..."
15   ps cax | grep docker > /dev/null
16   if [ $? -eq 0 ]; then
17     echo "Docker is running."
18   else
19     echo "Process is not running, starting it..."
20     sudo service docker start
21   fi
22 else
23   # Install docker repository
24   # Check that HTTPS transport is available to APT
25   if [ ! -e /usr/lib/apt/methods/https ]; then
26     sudo apt-get update
27     sudo apt-get -y install -y apt-transport-https
28   fi
29   # Add the repository to APT sources
30   echo deb http://mirror.yandex.ru/mirrors/docker/ docker main | sudo tee /etc/apt/sources.list.d/docker.list
31   # Import the repository key
32   sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
33   # Install docker
34   sudo apt-get update
35   sudo apt-get -y install lxc-docker-1.7.1
36 fi