Is it possible to distinguish whether a user is using Docker Toolbox or Docker for Mac/Windows?
I've already seen this.
In order to do some tests, now I have both Docker for Mac and Docker Toolbox installed and running. I can run Docker for Mac simply by running:
docker
and Docker Toolbox by running:
DOCKER_MACHINE_NAME=default DOCKER_CERT_PATH=$HOME/.docker/machine/machines/default DOCKER_TLS_VERIFY=1 DOCKER_HOST=tcp://192.168.99.100:2376 docker
.
As answered here. I tried checking DOCKER_TOOLBOX_INSTALL_PATH
env var, but in my case is empty. Then I thought that I could check whether the scheme of DOCKER_HOST
is tcp
and consider it to be Docker Toolbox, but then I realized that even with Docker for Mac is possible to have tcp
scheme for DOCKER_HOST
.
I then ran docker system info
for both Docker for Mac and Docker Toolbox. I noticed that in the first case there's:
Operating System: Docker for Mac
while in the second case:
Operating System: Boot2Docker 18.09.4 (TCL 8.2.1)
Is it safe then to check whether OperatingSystem
contains case-insensitive the string boot2docker
for both Mac and Windows?