forked from docker-java/docker-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_docker.sh
More file actions
executable file
·39 lines (30 loc) · 1008 Bytes
/
setup_docker.sh
File metadata and controls
executable file
·39 lines (30 loc) · 1008 Bytes
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
#!/usr/bin/env bash
set -exu
DOCKER_VERSION="${DOCKER_VERSION:-}"
DOCKER_HOST="${DOCKER_HOST:-}"
if [[ -n $DOCKER_VERSION ]]; then
sudo -E apt-get -q -y --purge remove docker-engine docker-ce
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-cache madison docker-ce
sudo apt-get install "docker-ce=$DOCKER_VERSION"
fi
if [[ -n $DOCKER_HOST ]]; then
sudo mkdir -p /etc/systemd/system/docker.service.d/
echo "
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H $DOCKER_HOST
" | sudo tee -a /etc/systemd/system/docker.service.d/override.conf
sudo systemctl daemon-reload
sudo service docker restart || sudo journalctl -xe
sudo service docker status
fi
while (! docker ps ); do
echo "Waiting for Docker to launch..."
sleep 1
done
docker version
docker info
docker run --rm hello-world