J7a4s0m5ine / docker-debian-installer

A shell script to install docker on any debian distro (Ubuntu, Debian, Parrot, Tails, Raspbian, etc)
GNU General Public License v2.0
6 stars 1 forks source link

Verify docker is actually installed/working #9

Open J7a4s0m5ine opened 1 year ago

J7a4s0m5ine commented 1 year ago

Final step currently just assumes docker installed properly and doesn't actually check before asking for reboot...lol..

Something like this should suffice, there's pros and cons to this solution. It would verify the container runtime has DNS/networking available to it, which requires internet. For some setups this would not be appropriate.

Maybe provide an option for different checks?

# Verify docker installation
DOCKERTEST=$(sudo docker run hello-world)

case "$DOCKERTEST" in
    *"Hello from Docker!"*) MESSAGE="Docker installation succeeded and testing valid, setting up non-root access" ; green_echo;;
    *) MESSAGE="Docker installation failed" ; red_echo;;
esac

This would be the easiest option, but doesn't validate the container runtime is started and everything, only that docker cli is responding

docker -v
Docker version 20.10.14, build a224086