Use Debian repositories for Docker

This commit is contained in:
Kris Lamoureux 2022-05-19 21:06:34 -04:00
parent ed9100bc8f
commit 1c321f6ef7
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
3 changed files with 2 additions and 83 deletions

View File

@ -1 +0,0 @@
deb [arch=amd64] https://download.docker.com/linux/debian buster stable

View File

@ -1,38 +0,0 @@
#!/bin/bash
# Github username and repo name
user="docker"
repo="compose"
# Retrieve the latest version number
addr="https://github.com/$user/$repo/releases/latest"
page=$(curl -s $addr | grep -o releases/tag/*.*\")
version=$(echo $page | awk '{print substr($1, 14, length($1) - 14)}')
# Download prep
url="https://github.com/$user/$repo/releases/download/$version"
file="docker-compose-$(uname -s)-$(uname -m)"
# Download latest Docker Compose if that version hasn't been downloaded
if [ ! -f /tmp/docker_compose_$version ]; then
curl -L $url/$file -o /tmp/docker-compose_$version
fi
# Is it already installed?
if installed=$(which docker-compose); then
new_chksum=$(sha256sum /tmp/docker-compose_$version)
old_chksum=$(sha256sum /usr/local/bin/docker-compose)
# If checksums are different, delete and install new version
if [ ! "$new_chksum" = "$old_chksum" ]; then
rm /usr/local/bin/docker-compose
mv /tmp/docker-compose_$version /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi
else
# It's not installed, so no need to remove
mv /tmp/docker-compose_$version /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
fi

View File

@ -1,43 +1,6 @@
# Copyright (C) 2019 Kris Lamoureux - name: Install Docker
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
- name: Remove old versions of Docker
apt: apt:
name: ['docker', 'docker-engine', 'docker.io', 'containerd', 'runc'] name: ['docker.io', 'docker-compose']
state: absent
update_cache: true
- name: Install HTTPS capability for apt
apt:
name: ['apt-transport-https', 'ca-certificates',
'curl', 'gnupg2', 'software-properties-common']
state: present
- name: Install Docker's signing key
apt_key:
url: https://download.docker.com/linux/debian/gpg
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
state: present
- name: Install Docker's stable repository
template:
src: docker-ce.list
dest: /etc/apt/sources.list.d/docker-ce.list
- name: Install Docker CE
apt:
name: ['docker-ce', 'docker-ce-cli', 'containerd.io']
state: present state: present
update_cache: true update_cache: true
@ -49,11 +12,6 @@
loop: "{{ docker_users }}" loop: "{{ docker_users }}"
when: docker_users is defined when: docker_users is defined
- name: Install docker-compose
script: install-compose.sh
args:
creates: /usr/local/bin/docker-compose
- name: Start Docker and enable on boot - name: Start Docker and enable on boot
service: service:
name: docker name: docker