I have some makefiles
where most of the stuff should run without configuration. These makefiles have used docker-machine
in the past.
Is there a way to detect in bash
if the user is using docker desktop for mac instead of docker-machine ?
The cleanest way I found so far is:
[[ $(docker version --format "{{.Server.KernelVersion}}") == *-moby ]]
The best way is to check for the existence of the DOCKER environment variables:
All four of these are set when eval $(docker-machine env)
is run and are required for use with docker-machine.
The beta does not require any of them being set and in fact requires you to unset them in order to function properly.
You can also do a check in the docker info
command looking for "moby" (the name of the docker for mac VM):
docker info | grep -q moby && echo "Docker for mac beta" || echo "Not docker for mac beta"
This is going to be dependent on consistency in the docker info
results, however.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With