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
• 10,610 points
559 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,700 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
• 7,340 points
882 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers

difference between the `COPY` and `ADD` commands in a Dockerfile

Hi, COPY and ADD are both Dockerfile instructions that serve similar purposes. They ...READ MORE

answered Dec 23, 2020 in DevOps & Agile by akhtar
• 38,230 points
4,536 views
+2 votes
1 answer
+2 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
• 58,090 points
2,426 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 30, 2018 in DevOps & Agile by Tyrion anex
• 8,700 points
866 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 7, 2018 in DevOps & Agile by Maverick
• 10,840 points
5,066 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP