How to create Mac OS X docker image? - macos

I am new to the docker. I need to create Mac OS X docker image.
is it possible? if Yes, How to create Mac OS X docker image?

Docker provides methods for managing OS-level containers and is built on top of Linux's native features for OS-level containerization. All containers running on a system share the same kernel; Mac OS X does not use the Linux kernel, but rather a mach kernel, so it cannot be run inside a Docker container at this time.
You can run Docker on your Mac but containers running on that instance would need to run Linux.

Related

OSX Docker Image on OSX Host?

Im well aware that i cannot run an OSX docker image on a linux or window host because they are totally different operating systems, but is it possible to have a OSX-based Docker image running ON an OSX host?
I would love to be able to utilize this for automating iOS application build processes.
Docker uses Linux kernel to make use of containerisation. Since MacOS uses a different kernel, this is not natively possible.
However, there are some approaches that you could try.

Docker for Mac and VMWare Fusion

So I have Docker for Mac installed and I would like to use VMWare Fusion rather than VirtualBox. Doing a search, I came across https://docs.docker.com/machine/drivers/vm-fusion/ using docker-machine. Not sure if that's what I'm looking for but when the Docker app starts I can see that the VMWare Fusion machine is suspended. Is there additional setup required to get new containers to run off of VMWare Fusion rather than VirtualBox?
Docker for Mac actually uses a native virtual machine implementation called xhyve based on the OSX Hypervisor.framework. Docker for Windows uses HyperV in a similar fashion.
Using a native VM implementation allows for tighter integration into the Docker app, rather than doing everything via Virtualbox's VBoxManage command as with the original boot2docker image and Docker Toolbox setup.

Could I use docker or something similar to deploy windows application?

I am running a game on Windows, and it requires every OS can only run one. And If I want to run more, currently I open vmware and run the game inside. But the problem is it takes too much memory and disk to run a whole another virtual OS. I know docker will reduce this, but it doesn't seem to support Windows.
Am I right? If so, any other solutions?
Docker uses LXC (linux containers) so cannot run a Windows operating system.
You can use docker on Windows using a boot2docker VM, but this is not the same as docker running a Windows operating system (your containers will run unix based operating systems inside the boot2docker VM).
To do what you're after, you'll need to use separate VMs.

Is there an App-V / Docker equivalent for Mac OSX?

Windows has a application-virtualisation tool called App-V.
Linux appears to have a similar tool called Docker.
My question is - is there a Docker equivalent for MacOS X? (ie without having to spin up a Linux virtual machine on VirtualBox?)
There is no strict analog for OS X. If you are against spinning up a virtual Linux machine, your options are:
A simple chroot jail. The jailkit utility can help you out with this.
For your own OS X applications, using App Sandbox to limit the resources your app has access to.
Again, neither of these is just like Docker 0.x, which uses LXC under the covers.
The chroot solution is closer, since it is one of the components that LXC is built on. However, it doesn't provide kernel namespaces or anything like cgroups — both of which are two very important parts of LXC.

Why can't you install docker natively in osx?

I would love to be able to use docker outside of Vagrant in OSX. Right now this is not possible. What are the specific reasons causing it not to be limited for linux installations only?
Docker is just an abstraction & automation layer on top of system-provided containers.
The technical limitation is that OS X does not support operating system-level virtualization, like containers in Linux or jails in FreeBSD (even despite the fact that OS X is a half-blood BSD).
But even despite that, Docker aims to provide an easy way to share container images, and to make sure that any Docker image would work on any Docker-compatible system, they had to limit it only to Linux. (That is probably why Docker doesn't support FreeBSD and friends, which do have containers.)
UPDATE: you can use projects like docker-osx or boot2docker to enjoy Docker on your OS X machine almost seamlessly (both create a Linux virtual machine behind the scenes.)

Resources