forked from 0k/0k-charms
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
578 B
20 lines
578 B
#!/bin/bash
|
|
|
|
need_restart=
|
|
if ! type -p docker; then
|
|
echo "Installing docker..."
|
|
curl -sSL https://get.docker.io | sh
|
|
fi
|
|
|
|
docker_version=17
|
|
if ! [[ "$(docker --version)" == "Docker version $docker_version"* ]]; then
|
|
version="$(apt-cache madison docker-ce | cut -f 2 -d \| | grep "$docker_version" | head -n 1 | xargs echo)"
|
|
## DOWNGRADE to 17.xx because 18.xx do not support registry v1
|
|
apt-get install -y --force-yes docker-ce="$version"
|
|
need_restart=true
|
|
fi
|
|
|
|
if [ "$need_restart" ]; then
|
|
systemctl daemon-reload &&
|
|
service docker restart
|
|
fi
|