|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +set +e |
| 4 | +: ' |
| 5 | +Licensed under the Apache License, Version 2.0 (the “License”); |
| 6 | +you may not use this file except in compliance with the License. |
| 7 | +You may obtain a copy of the License at |
| 8 | +http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +Unless required by applicable law or agreed to in writing, software |
| 10 | +distributed under the License is distributed on an “AS IS” BASIS, |
| 11 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +See the License for the specific language governing permissions and |
| 13 | +limitations under the License. |
| 14 | +
|
| 15 | + |
| 16 | +
|
| 17 | +' |
| 18 | + |
| 19 | +if (( $EUID != 0 )); then |
| 20 | + echo "Please run as root" |
| 21 | + exit |
| 22 | +fi |
| 23 | + |
| 24 | +# Remove any old Docker setup |
| 25 | +apt-get remove docker docker-engine docker.io -y |
| 26 | + |
| 27 | +# Common Update |
| 28 | +apt-get update -y |
| 29 | + |
| 30 | +# Install the repository |
| 31 | +apt-get install \ |
| 32 | + apt-transport-https \ |
| 33 | + ca-certificates \ |
| 34 | + curl \ |
| 35 | + software-properties-common |
| 36 | + |
| 37 | +# Add Docker GPG Key |
| 38 | +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - |
| 39 | + |
| 40 | +# Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A E2D8 8D81 803C 0EBF CD88 |
| 41 | +apt-key fingerprint 0EBFCD88 |
| 42 | + |
| 43 | +# Set up the stable repository |
| 44 | +add-apt-repository \ |
| 45 | + "deb [arch=ppc64el] https://download.docker.com/linux/ubuntu \ |
| 46 | + $(lsb_release -cs) \ |
| 47 | + stable" |
| 48 | + |
| 49 | +# Common Update |
| 50 | +apt-get update -y |
| 51 | + |
| 52 | +# Install Docker |
| 53 | +apt-get install docker-ce -y |
| 54 | + |
| 55 | +# Run Hello World |
| 56 | +docker run hello-world |
| 57 | + |
| 58 | +# Enable Docker service |
| 59 | +systemctl enable docker |
| 60 | + |
| 61 | +# Enabling Docker Remote API on Ubuntu 16.04 |
| 62 | +sed -i -- 's/ExecStart=\/usr\/bin\/dockerd -H fd:\/\//ExecStart=\/usr\/bin\/dockerd -H fd:\/\/ -H tcp:\/\/0.0.0.0:4243/g' /lib/systemd/system/docker.service |
| 63 | +systemctl daemon-reload |
| 64 | +service docker restart |
| 65 | +curl http://localhost:4243/version |
0 commit comments