Reputation: 539
I am learning Docker. I made a simple Dockerfile on ubuntu18 as below:
FROM gcc:4.9
COPY . /home/user/Desktop/HelloWorld
WORKDIR /home/user/Desktop/HelloWorld
RUN g++ HelloWorld.cpp -o HelloWorld
CMD ["./HelloWorld
I built and run it on ubuntu without any problem. Then i shared it on hub to can run it from outside. I tried to run the image on different Ubuntu and it worked fine I tried to run the image on Windows 7 and also worked fine!!
I don't know how it can run on windows despite docker file use g++
to build and ./
to run which is not supported on windows?
Is g++ --o HelloWorld HelloWorld.cpp
and CMD ["./HelloWorld]
getting run on windows? if not, so where they get run?
and what exactly FROM command does?
Upvotes: 0
Views: 50
Reputation: 6147
There is no "native" support for Linux containers in Windows. The official binary from docker solves this by provisioning a virtual machine using Hyper V that runs a small Linux distribution an the docker daemon.
The docker cli runs natively on Windows but is configured to use a remote daemon (the one in the VM).
So your linux containers does not run on windows, they run on Linux (and in case you use docker for Windows it is in a VM)
Upvotes: 1