4 ms·
Can I expect a dockerfile that 100% works on Linux to 100% on Mac and Windows?
by ben_jones 10y ago
Can I expect a dockerfile that 100% works on Linux to 100% on Mac and Windows?
- ktzar 10y agoShort answer, yes. Medium answer, images your Dockerfile is based on are still run in a Linux environment, even if it's virtualised differently.
- adamhepner 10y agoWait now, hold on a minute. I'm very confused and curious how does this work? Can I run any linux-based container on Windows? Can I run (are there any?) windows-based containers? If so, does it work the other way around: windows container on linux host? Does it somehow use the recently published Linux Subsystem for Windows, or is it completely different compatibility layer? If it is different, doesn't it seem like a waste of effort?
- jimlei 10y ago> Can I run any linux-based container on Windows? No, on windows you still have to run a Linux vm which the containers will run inside. Meaning all containers actually run on a Linux host. The new Docker for Windows app only abstract away some stuff so it feels easier working with. > does it work the other way around No
- mh-cx 10y ago> No, on windows you still have to run a Linux vm which the containers will run inside. I don't think, that's correct. To me that's the whole point of having a native Windows / Mac version of docker. From their feature list: > Faster and more reliable – native development environment using hypervisors built into each operating system. (No more VirtualBox!)
- drdaeman 10y agoNo, GP got it right. The quoted part is that instead of VirtualBox one can use Hyper-V. In either case, it's handled by docker-machine which runs a GNU/Linux VM with Docker (host) tools installed, and containers are ran on that VM. I would be surprised if there aren't plans to support WSL (to run Linux-targetting binaries on Windows "natively", thus have "native" Docker containers) but don't think that's available yet.
- justincormack 10y agoNative Windows containers are in beta and will be released later this year. You cannot run them on Linux hosts. They do not use the Windows subsystem for Linux, they are really native for Windows.
- justinhj 10y agoDockerfiles describe how to build an image. You can build the image on any docker host and it will be identical. The differences occur only when you run the image and it becomes a container. The way networking and file systems behave can vary depending on the host and run command options.
- ben_jones 10y agoSo if I have an application that utilizes networking or the file system it will have to use separate dockerfiles depending on platform?
- justinhj 10y agoUsually you have a Dockerfile to build an image then you would deploy it to servers with different run parameters. You could also have dockerfiles that take a base image and then add some environment specific configuration IMHO it's better to keep the images identical across environments, and pass runtime configuration when deploying