Bootstrap: use multi-platform installer

* Limit auto-install to root users; otherwise, give manual install guidance
* Support non-Debian/Ubuntu with the multi-OS get.docker.com installer
This commit is contained in:
Jeremy Daer
2023-04-10 10:42:29 -07:00
committed by Jeremy Daer
parent 4fa6a6c06d
commit e85bd5ff63
7 changed files with 88 additions and 22 deletions

View File

@@ -0,0 +1,21 @@
class Mrsk::Commands::Docker < Mrsk::Commands::Base
# Install Docker using the https://github.com/docker/docker-install convenience script.
def install
pipe [ :curl, "-fsSL", "https://get.docker.com" ], :sh
end
# Checks the Docker client version. Fails if Docker is not installed.
def installed?
docker "-v"
end
# Checks the Docker server version. Fails if Docker is not running.
def running?
docker :version
end
# Do we have superuser access to install Docker and start system services?
def superuser?
[ '[ "${EUID:-$(id -u)}" -eq 0 ]' ]
end
end