How does Docker run a Linux kernel under macOS host? - linux

I installed Docker on my macOS Sierra as follows. Note I don't have VirtualBox installed.
brew cask uninstall virtualbox
brew cask install docker
My macOS details.
$ uname -a
Darwin m-C02QG7TRG8WN.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar 3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
$ docker version
Client:
Version: 17.03.1-ce
API version: 1.27
Go version: go1.7.5
Git commit: c6d412e
Built: Tue Mar 28 00:40:02 2017
OS/Arch: darwin/amd64
Server:
Version: 17.03.1-ce
API version: 1.27 (minimum version 1.12)
Go version: go1.7.5
Git commit: c6d412e
Built: Fri Mar 24 00:00:50 2017
OS/Arch: linux/amd64
Experimental: true
Once I run Docker from launchpad, I am able to run Docker containers.
$ docker run -it ubuntu
root#2351d4222a4e:/# uname -a
Linux 2351d4222a4e 4.9.13-moby #1 SMP Sat Mar 25 02:48:44 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
My question is how does Docker manage to run a Linux kernel within macOS? I thought Docker would at least require boot2docker or some other such Linux kernel running so that it can create the Ubuntu's filesystem with the help of it. But the above output seems to indicate that it is not so. Where does the Linux kernel come from then?

While the other answers are correct about the hypervisor, they don't answer your specific question.
The answer is "Docker [Desktop] for Mac" does run a Linux host VM with a replacement for boot2docker - LinuxKit developed and maintained by Docker for the purpose of making lightweight distributions.
https://blog.docker.com/2017/04/introducing-linuxkit-container-os-toolkit/
The uname you saw didn't have the keyword in it, but it seems to be included now, e.g. from Docker for Mac 18.03.1 I see:
Linux a8e079429a51 4.9.87-linuxkit-aufs #1 SMP Wed Mar 14 15:12:16 UTC 2018 x86_64 Linux
You can see links to the included versions on the release pages.
https://docs.docker.com/docker-for-mac/release-notes/
So it's not so different from the old days Docker Machine + VirtualBox + boot2docker,
for the new days, it's just
the provisioning is done internally by "Docker [Desktop] for Mac"
and VirtualBox is replaced by Apple's Hyperkit,
and the "default VM" is a bit more tucked away.

The early version Docker used VirtualBox to run virtual machine for Docker. Since June 2016, the way to run Docker on Mac and Windows became much simpler, there's the official release introduction blog for Docker on Mac/Windows, and there's also some introduction from docker mac website:
Docker for Mac is a complete development environment deeply integrated with the MacOS Hypervisor framework, networking and filesystem.
And with the structure looks like:

Docker is using Apple's Hypervisor Framework: https://developer.apple.com/reference/hypervisor
More reading on the Docker blogs for when then came out last year: https://blog.docker.com/2016/05/docker-unikernels-open-source/

Related

Why does the Electron Quickstart App fail to start correctly on my Ubuntu instance?

I followed the following steps on a fresh installation of Ubuntu 20.10:
# Clone this repository
git clone https://github.com/electron/electron-quick-start
# Go into the repository
cd electron-quick-start
# Install dependencies
npm install
# Run the app
npm start
The output fromm the start command is:
up to date, audited 89 packages in 1s
found 0 vulnerabilities
> electron-quick-start#1.0.0 start
> electron .
(node:4081) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See https://github.com/electron/electron/issues/23506 for more information
The resulting window looks like this:
System Information:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.10
Release: 20.10
Codename: groovy
Linux andy-Parallels-Virtual-Platform 5.8.0-31-generic #33-Ubuntu SMP Mon Nov 23 18:44:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Node version: v15.3.0
Electron-quick-start commit hash: 2b0dbb098
After doing a Google Image search I found the cause and the current resolution:
https://github.com/electron/electron/issues/26061
This only happens on Parallels at a specific version.

Running docker container with ubuntu:16.04 actually runs ubuntu 18.04

I was trying to run a docker container with ubuntu:16.04 (on a ubuntu 18.04 machine) with the following command:
docker run -i -t --name ubuntu ubuntu:16.04 /bin/bash
Running this command attaches me to a container. But when I check the kernel information with uname -a, it shows that the current kernel is Ubuntu 18.04. Following is the result I get:
Linux 1ac6c3456e2a 5.3.0-40-generic #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
What could be the cause?
Docker uses host OS kernel, there is no custom or additional kernel inside container. All containers which run on a machine are sharing this "host" kernel.
Please read this for more detail.
So #32~18.04.1-Ubuntu SMP Mon Feb 3 14:05:59 UTC 2020 in the output of uname -a is actually the Kernel version of the host machine.
To verify that you are running Ubuntu 16:04, run cat /etc/os-release. It will provide you details about your OS.

How to install dlib on Ubuntu VPS on digital ocean

I have created a ubuntu vps which has below specs:
Linux ubuntu-sh5tb8912admin 4.15.0-66-generic #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
I have to run pthon flask web app on it and for it I need to install dlib. I have tried all the whl files mentioned in this link but all I am getting is
dlib-19.8.1-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
I simply download them using wget dlib-xxxx-xx.whl and then install using pip3 install dlib-xxxx-xx.whl but it gives me above error. I have a python 3.6.8 installed
Can anyone please help how can I install dlib.?
If the wheels have a win in their name I guess they are windows-releases not for GNU/Linux. Did you try downloading one of the tar.gz files those should be the ones for Linux.
git clone https://github.com/Universe-ML21/script_install_dlib.git
sudo chmod +x script_install_dlib/auto_dlib.sh
bash script_install_dlib/auto_dlib.sh

node version difference between mac and linux

on my mac, key node -v, I get "v6.2.2", on centos, I get "v0.10.36", on centos, I keys "uname -a", I get "Linux VM_80_24_centos 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux", how can I understand the difference between two version num.
It seems like one is node version and another is npm version. You might executed the different commands.
To check node version:
node -v
will give 'v6.2.2'.
To check npm version:
npm -v
will give 'v0.10.36'.

git on linux, Right path, wrong version number

[wen#localhost git-master]$ /usr/local/bin/git --version
git version 1.9.0.GIT
[wen#localhost git-master]$ which git
/usr/local/bin/git
[wen#localhost git-master]$ git --version
git version 1.7.1
Installed follow Getting-Started-Installing-Git
My linux dist info.
[wen#localhost git-master]$ uname -a
Linux localhost.localdomain 2.6.32-431.11.2.el6.x86_64 #1 SMP Tue Mar 25 19:59:55 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[wen#localhost git-master]$ cat /etc/centos-release
CentOS release 6.5 (Final)
What's wrong with this ?
BTW, I installed the Development Tools which contains Git 1.7.1.
Follow below, I resolve the problem.
yum remove git
exit
# reopen an terminal
Now, everything is ok :-)
EDIT
Actually, the problem is caused by hash(man hash,help hash),
you can clear all cache by hash -r, or only one cache hash -d git.
But, I think, remove the old version is not bad,saved my disk prevent the conflict.

Resources