You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to add a check on the docker.mk file to see if the there is an internet connection and not do a docker-compose pull if not connected?
I sometimes run a dev environment without internet (airplane) and this command fails. I do get around it by running docker-compose up -d, but was wondering...
The text was updated successfully, but these errors were encountered:
I don't know if you're still interested in this. I took the check below from one of my Bash scripts and changed it to fit. You could stick it in a Bash script and alias it.
Variable packetLoss will contain the percentage packet loss of the ping command. For example 0 when 0% packet loss. From this example ping -qc 10 wordpress.com output:
PING wordpress.com (192.0.78.9) 56(84) bytes of data. --- wordpress.com ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 21ms rtt min/avg/max/mdev = 42.733/43.114/43.764/0.334 ms
PING wordpress.com (192.0.78.9) 56(84) bytes of data. --- wordpress.com ping statistics --- 10 packets transmitted, 0 received, 100% packet loss, time 117ms
#!/bin/bash#-- Variable 'packetLoss' must be null (or > 100) before pinging. Because '0' means no packet loss.
packetLoss=
acceptablePacketLoss=0
packetLoss=$(echo $(ping -qc 10 wordpress.com)| sed -r 's|\s*.*,\s*([[:digit:]]*)% packet loss,.*ms$|\1|')if [ "$packetLoss"-le"$acceptablePacketLoss" ];then
make up #-- docker-compose up -dreturn 0
elseecho -e "Packet loss is $packetLoss%\nAcceptable packet loss is $acceptablePacketLoss%\nSkipping!"return 1
fi
Is there a way to add a check on the docker.mk file to see if the there is an internet connection and not do a
docker-compose pull
if not connected?I sometimes run a dev environment without internet (airplane) and this command fails. I do get around it by running
docker-compose up -d
, but was wondering...The text was updated successfully, but these errors were encountered: