Why can't you install docker natively in osx? - macos

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.)

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.

Is it possible to access a hardware device with a Docker image under Windows?

Recently, a native Docker client for Windows was released (>= Windows 7).
I wonder: is it possible to forward access to physical devices, running Windows as host?
With a *nix host, this seems to be possible with the following syntax:
docker run -t -i --device=/dev/ttyUSB0 ubuntu bash
(as proposed here) which would forward the USB device /dev/ttyUSB0 on a *nix system to the docker image.
A description of the --device flag can be found in the docker docs.
What would be the syntax for a Windows host?
Windows USB devices are not currently available to Docker containers run with Docker for Windows.
Answered by a Docker staff member on the 7th of July 2017 in the Docker forum.
https://forums.docker.com/t/exposing-docker-to-usb-device-in-windows-10-with-docker-toolbox/29290/3
This answer is likely to get outdated in some time, provided they will allow for this feature somehow.
This is a bad practice as it goes against the design philosophy of containers.
If you find yourself needing access to a hardware device, it's better to consider full virtualization such as VMware, Hyper-V, KVM/QEMU, Xen and so on.
However, the "proper" way is to design your system
so that hardware is abstracted into a network service. In this way, you deploy the service to physical machines to which the hardware is attached, and call them over the network. I don't know if this is possible in your case, but such decoupling provides a significant architectural advantage.

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.

Docker.io for Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I was reading a nice question about docker - answer has overview of docker implementation details. I was wondering if anything like this is possible to do on Windows platform.
Do Windows alternatives for Docker exist?
Is it theoretically possible to use other (Windows based) components to build it?
Update1:
Slightly related question (sandboxing): Is there a lightweight, programmable Sandbox API for the Windows platform?
Update2::
For info how to install docker on windows (unrelated) - official docs has great instructions how to set up the environment by using boot2docker VM.
You can run docker in a virtual machine.
New Update
Vagrant has now integrated docker support. It can be used as provider or as provisioner. Here are some useful links.
Feature Preview: Docker-Based Development Environments
Vagrant Docs: Docker Provisioner
Vagrant Docs: Docker Provider
Old Update
As seanf pointed out in a comment below, Vagrant support was dropped. Instead they point to boot2docker:
boot2docker is a lightweight Linux distribution based on Tiny Core
Linux made specifically to run Docker containers. It runs completely
from RAM, weighs ~24MB and boots in ~5s (YMMV).
Old answer
The official docker documentation contains a small guide to install docker inside a Vagrant box. Vagrant is a great vm management wrapper. The guide is for Mac/Linux, but you get the idea to do the same in Windows:
http://docs.docker.io/en/latest/installation/vagrant/
This way you can share docker images across multiple systems with different operating systems.
If you're just searching for a way to deploy a pre-packaged set of applications in some sort of container for Windows, with registry and file access being virtualized but without using a full-blown virtual machine image, these (commercial) sandbox-like applications might be worth looking at:
Symantec Workspace Virtualization (get some ready-to-use packages from here)
Evalaze
Cameyo
BoxedApp
Edit: There's a new kid on the block, Spoon supports containers for Windows, and it actually looks very promising.
I have found that at least file system related functionality has Windows (7,8) already in place. One can use VHD files (virtual disks) for handling "images" concept in Docker. These image are used for virtual machine but can be created/attached/used directly by Windows too:
diskpart
DISKPART> create vdisk file=c:\base-image.vhd maximum=200 type=expandable
New image can be layered on top of base image:
DISKPART> create vdisk file=c:\image-2.vhd parent=c:\base-image.vhd
See more information about managing virtual disks.
Unfortunately, process lightweight isolation/sandboxing is probably not possible (at least not simple), although some methods do exists (http://www.sandboxie.com/, Native Client in Google Chrome ...)
Microsoft is working on their own Hyper-V Container that is similar to Docker - Azure also supports the Docker infrastructure.
That aside, it's hard to give precise alternatives but on the Windows side we've had App-V for quite a long time which virtualises and sand-boxes applications so they can be run or streamed without being actually installed on a specific system. I've never meddled with it but it seems to be able to run as a standalone client without any need of the intricate server infrastructure usually involved for anything Microsoft.
From another perspective the disk image format used by Windows (VHD) supports standard differencing so you can easily run many virtual machines from a single read-only OS image where each virtual machine have a tiny write image to handle the differences. These are still fullblown virtual machines though.
I currently don't know of any way to do the same thing on native windows as of right now.
I don't think the windows kernel was built for this sort of thing, so in order for it to be supported Microsoft would have to add the capabilities to the windows kernel. If I'm wrong, someone please correct me.
The most common way for people to do something like this is to use a VM in windows that runs a Linux based OS, and running everything inside of that. You could also do the same thing using FreeBSD (Jails), and Solaris (zones), if that is more your cup of tea. But Docker currently doesn't support FreeBSD or Solaris, so you will need to use the native tools for those.
Now you can run docker natively on windows
See http://docs.master.dockerproject.com/installation/windows/
And
http://azure.microsoft.com/blog/2015/04/16/docker-client-for-windows-is-now-available?Ocid=OutgoingPromotion_Social_TW_Azure_20150416_169251868&linkId=13596123
Starting in june 2016, Docker can be run on Microsoft's Hyper-V virtualization on Windows 10 hosts. This is now the preferred and "official" way to run Docker on Windows.
https://docs.docker.com/engine/installation/windows/
Hyper-V is a Type-1-Hypervisor, meaning docker will run one layer closer to the host hardware and perform significantly faster than boot2docker (which uses VirtualBox, a Type-2-Hypervisor, running inside the host OS).
The performance benefit for docker has a downside too: Enabling Hyper-V will prevent hardware virtualization features for Type-2-Hypervisors, therefore existing VirtualBox images can not be used with VTx, and you might want to consider moving other virtualized OSes to Hyper-V as well.
Windows 7-8.1 hosts can still use boot2docker to run Docker containers, but the main development focus for Docker on Windows is the "new" Hyper-V-Docker.
Hyper-V is only on Windows Pro. Install it for £110.
Or simply install Vagrant, install VirtualBox, install GIT bash, then from your GIT bash terminal.
git clone git#github.com:danday74/vagrant-docker-skelly.git
cd vagrant-docker-skelly
vagrant up # takes approx 5 mins to create VM
vagrant ssh
docker -v
docker-compose -v
The Vagrantfile shows that:
1 - this is a Xenial VM with docker and compose installed on it
2 - Ports mapped from Host to the VM are 9900-9920
3 - The shared folder is shared from host to VM
Tweak this as desired.
I got tired fighting with a maven docker plugin so I figured I would be able to fake it. This is how:
Using boot2docker and the following bat file makes it look like you're running docker natively. Place it on your path.
#set SSH="C:\Program Files (x86)\Git\bin\ssh.exe"
#set RUN_REMOTE='docker %*'
# %SSH% -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -p 2022 -i %HOMEPATH%/.ssh/id_boot2docker -tt docker#localhost %RUN_REMOTE%
The ssh.exe comes from the msys-git package which is bundled with boot2docker.
I'm pretty sure this solution have quite a few caveats, but it works pretty good for me.
Place this file on your path and bob's yer uncle.

Resources