How can a script identify the difference between Docker Toolbox and Docker for Windows?

0 votes
Currently, I’m moving from Docker Toolbox to Docker for Windows. A lot of my scripts still assume that they’re running Docker Toolbox on VirtualBox.

Is there any way to tell, from inside a script, whether docker is coming from Docker Toolbox or Docker for Windows?
Aug 24, 2018 in DevOps & Agile by Sophie may
• 9,530 points
58 views

1 answer to this question.

0 votes

Now, the Toolbox works through docker-machine. The way the docker client is directed to the virtual machine is via a number of environment variables which you can see by running docker-machine env default

SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=/user/.docker/machine/machines/default
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM     @FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO @%i

Docker for Mac connects directly to the /var/run/docker.sock socket which is mapped into the Docker VM so this is easy to detect by the lack of environment variables.

I believe Docker for Windows uses a named pipe in the same way (//./pipe/docker_engine) so you should also be able to tell by the lack of DOCKER_HOSTin the environment.

If Docker for Windows does still use the environment, there will be differences between the Toolbox and Docker for Windows variables. DOCKER_HOST would be on a different range. DOCKER_CERT_PATH won't include machine etc.

answered Aug 24, 2018 by Tyrion anex
• 8,280 points

Related Questions In DevOps & Agile

+2 votes
1 answer

What is the difference between a container and an image in Docker?

 Below is reference which you can follow to know ...READ MORE

answered Sep 20, 2018 in DevOps & Agile by shubham
• 6,890 points
47 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 56,520 points
132 views
0 votes
1 answer

How to a run deployed app in Docker for Windows?

To deploy an ASP.NET web application to ...READ MORE

answered Aug 29, 2018 in DevOps & Agile by Tyrion anex
• 8,280 points
112 views
0 votes
2 answers

How to customize the RAM allocation on Docker for Windows?

Try this: docker update --cpu-shares 5120 -m 3000M ...READ MORE

answered Dec 6, 2018 in DevOps & Agile by Maverick
• 10,040 points
78 views