Update install_portainer.sh

This commit is contained in:
Ryan Fortner
2021-10-06 10:35:41 -04:00
committed by GitHub
parent 640ddff58d
commit 23ffae3d86

View File

@@ -1,4 +1,25 @@
#!/bin/sh
sudo docker pull portainer/portainer-ce:latest
sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
#!/bin/sh
function error {
echo -e "\\e[91m$1\\e[39m"
exit 1
}
function check_internet() {
printf "Checking if you are online..."
wget -q --spider http://github.com
if [ $? -eq 0 ]; then
echo "Online. Continuing."
else
error "Offline. Go connect to the internet then run the script again."
fi
}
check_internet
sudo docker pull portainer/portainer-ce:latest || error "Failed to pull latest Portainer docker image!"
sudo docker run -d -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest || error "Failed to run Portainer docker image!"