11

I am new to docker and so my question could be very naive/stupid. The application that we use presently need to be compiled in different platform to make it work in desired platform i.e Linux and Window mainly. So we need to compile source code(C/C++) in different platform and give different executable to customer as per their OS . My question is 1. Is it possible with docker that i have one executable which work in all platform ? i.e i compile my source code in one platform e.g in Linux and ship executable with docker to run in Window platform

Thanks in advance

jww
  • 97,681
  • 90
  • 411
  • 885
pgh
  • 213
  • 3
  • 11

3 Answers3

2

You still need to compile source code on different platforms. The point of the docker is to automate building and testing the code on every platform, so that you can just work on the code, and let it build and test on every platform.

You do have to set up the dockers and test scripts and get the code working cross-platform in the first place. But after that is done, you can basically not worry about any other platform unless you actually break it.

Kenny Ostrom
  • 5,639
  • 2
  • 21
  • 30
  • Thanks for your answer. I have this query that If i run my application for testing with docker whether it's execution becomes too slow as compared if run directly on desired platform – pgh Apr 15 '15 at 14:27
2

Docker allows to run run the same container in any modern Linux distribution - you only need docker installed here. You cannot run these containers directly on Windows - you need to run virtual machine with Linux which will run docker container. That is what boot2docker is doing - running docker containers on Windows and Mac Os X in virtual machine. In some cases it is acceptable.

ISanych
  • 21,590
  • 4
  • 32
  • 52
  • Thanks for the answer . When we are saying container , is it same as executable i.e one compiled with desired source code. ? . If yes, then does it it mean that i can run this exe on any modern linux distribution, if they have docker installed there. – pgh Apr 15 '15 at 14:35
  • container is a set of files - usually based on some Linux distribution (for example Ubuntu) - like small and lightweight virtual machine - so it is usually hundreds binaries (Linux binaries, not windows .exe) typical for posix environment (but some people using very small base images). Also there are binaries which executed in container by default. That is why you are able to run Ubuntu application in container on RedHat Linux for example - because all Ubuntu dependencies already there. – ISanych Apr 15 '15 at 14:56
  • Thanks it clarified by doubt . Just one last question . If i run my application for testing with docker whether it's execution becomes too slow as compared if run directly on desired platform. Any idea or comment on it . – pgh Apr 15 '15 at 15:03
  • Because docker is using LXC performance of containerized application almost the same as if would be executed directly - overhead is very small. But again it is only about Linux - if you will run it on other platforms you will need to run vm, which will have bigger impact on performance (but in many cases it is still acceptable). – ISanych Apr 15 '15 at 15:23
  • @pgh: if your host is a Linux, docker runs at native speed. After all, it's just a glorified chroot/lxc, as dockerized apps runs with the host's kernel. If you're running on any other OS, then it will have to have a virtual machine running Linux which runs Docker. This means you'll get the overhead of the virtual machine. Whether that's fast enough can only be answered by yourself. – Lie Ryan Apr 15 '15 at 15:41
  • @Lie Ryan: My application is numerical in nature which is parallelised using MPI (Message passing interface)and run on HPC cluster in general. Its good to know that overhead will be quite insignificant in different Linux distribution . I need to check overhead in window with some simple application to decide whether it will be within acceptable limit – pgh Apr 15 '15 at 15:48
1

No it can't, docker is Linux only. To run docker in Windows, you need a virtual machine.

Unless you spend the time to wrap your installer script to install the virtual machine and all, you might as well just run a proper VM in a Virtual Box or VMWare of your choice. Even then your application experience on Windows will be second rate as it's not running natively.

Lie Ryan
  • 62,238
  • 13
  • 100
  • 144