Giter Site home page Giter Site logo

boot2docker-xhyve's Introduction

Boot2Docker running on xhyve hypervisor

Features

  • boot2docker v19.03.5
  • Disable TLS
  • Expose the official IANA registered Docker port 2375
  • Support NFS synced folder: /Users is NFS-mounted on the boot2docker VM.

Requirements

  • xhyve
    • Mac OS X Yosemite 10.10.3 or later
    • A 2010 or later Mac (i.e. a CPU that supports EPT)

Caution

  • Kernel Panic will occur on booting, if VirtualBox (< v5.0) has run before.
  • Pay attention to exposing the port 2375 without TLS, as you see the features.

Installing xhyve

$ git clone https://github.com/mist64/xhyve
$ cd xhyve
$ make
$ cp build/xhyve /usr/local/bin/    # You may require sudo

or

$ brew install xhyve

Setting up Boot2Docker images and tools

$ git clone https://github.com/ailispaw/boot2docker-xhyve
$ cd boot2docker-xhyve
$ make

Booting Up

$ sudo ./xhyverun.sh

Core Linux
boot2docker login: 

or

$ make run    # You may be asked for your sudo password
Booting up...
  • On Terminal.app: This will open a new window, then you will see in the window as below.
  • On iTerm.app: This will split the current window, then you will see in the bottom pane as below.
Core Linux
boot2docker login: 

Logging In

  • ID: docker
  • Password: tcuser (in most instances you will not be prompted for a password)
$ make ssh
[email protected]'s password:
   ( '>')
  /) TC (\   Core is distributed with ABSOLUTELY NO WARRANTY.
 (/-_--_-\)           www.tinycorelinux.net

docker@boot2docker:~$ 

Shutting Down

Use halt command to shut down in the VM:

docker@boot2docker:~$ sudo halt
docker@boot2docker:~$ reboot: System halted
$ 

or, use make halt on the host:

$ make halt
[email protected]'s password:
Shutting down...

Using Docker

You can simply run Docker within the VM. However, if you install the Docker client on the host, you can use Docker commands natively on the host Mac. Install the Docker client as follows:

$ curl -L https://get.docker.com/builds/Darwin/x86_64/docker-latest -o docker
$ chmod +x docker
$ mv docker /usr/local/bin/    # You may require sudo

Alternatively install with Homebrew:

$ brew install docker

Then, in the VM, or on the host if you have installed the Docker client:

$ make env
export DOCKER_HOST=tcp://192.168.64.3:2375;
unset DOCKER_CERT_PATH;
unset DOCKER_TLS_VERIFY;
$ eval $(make env)

$ docker info
Client:
 Debug Mode: false

Server:
 Containers: 0
  Running: 0
  Paused: 0
  Stopped: 0
 Images: 0
 Server Version: 19.03.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: b34a5c8af56e510852c35414db4c1f4fa6172339
 runc version: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
 init version: fec3683
 Security Options:
  seccomp
   Profile: default
 Kernel Version: 4.14.154-boot2docker
 Operating System: Boot2Docker 19.03.5 (TCL 10.1)
 OSType: linux
 Architecture: x86_64
 CPUs: 1
 Total Memory: 989.5MiB
 Name: boot2docker
 ID: JBFU:TNYM:YDW6:QLMG:G44I:VTAG:QXBY:QM44:WGQB:EFRM:4477:SIJW
 Docker Root Dir: /mnt/vda1/var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Product License: Community Engine

WARNING: API is accessible on http://0.0.0.0:2375 without encryption.
         Access to the remote API is equivalent to root access on the host. Refer
         to the 'Docker daemon attack surface' section in the documentation for
         more information: https://docs.docker.com/engine/security/security/#docker-daemon-attack-surface

Upgrading Boot2Docker

When Boot2Docker is upgraded and boot2docker-xhyve is updated,

$ git pull origin master
$ make upgrade

Resources

  • /var/db/dhcpd_leases
  • /Library/Preferences/SystemConfiguration/com.apple.vmnet.plist
    • Shared_Net_Address
    • Shared_Net_Mask

boot2docker-xhyve's People

Contributors

ailispaw avatar apatrushev avatar chalharu avatar timfallmk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

boot2docker-xhyve's Issues

Running a container on startup?

Hey there,

I want to run nginx-proxy at startup, as combining it with dnsmasq allows easy defining of URLs for web containers running on arbitrary ports.

How and where do I need to change to add this, and have it persist?

Minor README revisions

  1. make run demands a password. In case it isn't obvious, this is your sudo password, not 'docker'.
  2. When logging in, there is no password. Entering 'docker' as username logs you straight in.
  3. The command 'docker info' must be run in the VM, but this isn't reflected in the description.

I'd like to see some description about how might go about sharing volumes, exposing ports etc.

Is there a way to increase disk space?

Hey there,

Great project. It made it super easy to get started with boot2docker and xhyve! Thanks for putting the work into it.

While working with docker-compose on a rails app, I use the "make a container for persisting database/gems" strategy. As a result, my host container (in this case boot2docker) needs a bit more space than the default. I'm not sure how to coordinate this, but I'm willing to learn if you have time to point me in the right direction.

Thanks!

uuid2ip blocks forever with 2 wired NICs

I'm using MBA with a thunderbolt display and another USB-NIC.
MacOS recognizes wireless one, thunderbolt one and USB one.
In this case, uuid2ip's dispatch_semaphore_wait() blocks forever.

Disconnecting either thunderbolt display or USB-NIC solves this problem.
Removing Network-service of thunderbolt display entry in system-config pane also solves.

in the pane, following does not work:

  • USB-NIC
  • Thunderbolt Display LAN
  • WiFi

and following does work:

  • USB-NIC
  • WiFi

I'm suspecting that this caused in multi-NICs environment.
Currently I can boot and login coreos by disabling Thunderbolt Display LAN service.

Client can't connect even with env vars set correctly?

Hey there,

I have boot2docker-xhyve setup, and as far as I can tell it's set up correctly, however the client refuses to connect even with the environment variables set correctly?

$ docker info
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Now, make ssh works fine, and I can run docker from inside the xhyve VM

In my ~/.zshrc I have the following:

## Set up boot2docker-xhyve env vars
pushd $HOME/Development/tools/boot2docker-xhyve > /dev/null
unset DOCKER_TLS_VERIFY
unset DOCKER_CERT_PATH
export DOCKER_HOST=tcp://`make ip`:2375
popd &> /dev/null
$ echo $DOCKER_HOST
tcp://192.168.64.2:2375

Originally, this computer had the Docker Toolbox installed, however this should have all been removed: I deleted the ~/.docker folder to ensure it wasn't loading the wrong configuration, but I can't for the life of me work out whats happening here. Docker versions in both the client and the VM are 1.9.1

Can't boot boot2docker v1.7.1

$ sudo ./xhyverun.sh
vm exit[0]
            reason      VMX
                                    rip     0x00000000004011be
                                                                            inst_length 2
                                                                                                    status      0
                                                                                                                            exit_reason 15
            qualification   0x0000000000000000
                                                    inst_type       0
                                                                                    inst_error      0
                                                                                                                 ./xhyverun.sh: line 35:  2288 Abort trap: 6           xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f kexec,$KERNEL,$INITRD,"$CMDLINE"

`docker` cli tools don't work from mac to boot2docker

Having a weird issue on a clean install on a new mac (I've been running this for the past month and it's been a breeze!) If I make ssh, I'm able to get into the boot2docker instance just fine, and docker commands work without an issue. When I try from my mac though, I get an instant reply:

Cannot connect to the Docker daemon. Is 'docker -d' running on this host?

I'm setting DOCKER_HOST with the results of make ip (in the standard format, like tcp://192.168.64.2:2375). Any idea what could be going wrong or anything I can provide to help debug this?

/etc/localtime is a directory, not a file

By itself this isn't a problem (and given xhyve's issues with maintaining correct time after the host sleeps, may not actually matter for some time yet), but it does mess with some docker-compose wiring that we're doing to ensure that real servers keep consistent timezones with their hosts.

The base image that boot2docker-xhyve is based on should have a file at /etc/localtime, not a directory. http://man7.org/linux/man-pages/man5/localtime.5.html

[colin@trymon boot2docker-xhyve (master)]$ make clean
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C uuid2ip clean
rm -f .mac_address
rm -f initrd.img vmlinuz64
rm -f boot2docker.iso
rm -f boot2docker-data.img
rm -f boot2docker-data.tar.gz
[colin@trymon boot2docker-xhyve (master)]$ make
curl -OL https://github.com/timfallmk/boot2docker/releases/download/v1.8.1/boot2docker.iso
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   578    0   578    0     0   1250      0 --:--:-- --:--:-- --:--:--  1248
100 28.0M  100 28.0M    0     0  1480k      0  0:00:19  0:00:19 --:--:-- 1630k
hdiutil mount boot2docker.iso
/dev/disk6                                              /Volumes/Boot2Docker-v1.8
cp /Volumes/Boot2Docker-v1.8/boot/initrd.img . && sync
hdiutil unmount /Volumes/Boot2Docker-v1.8
"/Volumes/Boot2Docker-v1.8" unmounted successfully.
hdiutil mount boot2docker.iso
/dev/disk6                                              /Volumes/Boot2Docker-v1.8
cp /Volumes/Boot2Docker-v1.8/boot/vmlinuz64 . && sync
hdiutil unmount /Volumes/Boot2Docker-v1.8
"/Volumes/Boot2Docker-v1.8" unmounted successfully.
curl -OL https://github.com/ailispaw/boot2docker-xhyve/releases/download/v0.6.0/boot2docker-data.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   585    0   585    0     0    636      0 --:--:-- --:--:-- --:--:--   636
100 4084k  100 4084k    0     0   785k      0  0:00:05  0:00:05 --:--:-- 1106k
tar zxvf boot2docker-data.tar.gz
x boot2docker-data.img
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C uuid2ip
cc main.c
ld uuid2mac.sym
dsym uuid2mac.dSYM
strip uuid2mac
[colin@trymon boot2docker-xhyve (master)]$ make run
Booting up...
tab 1 of window id 14807
[colin@trymon boot2docker-xhyve (master)]$ docker run -v /etc/localtime:/etc/localtime:ro -it --rm mongo bash
Unable to find image 'mongo:latest' locally
latest: Pulling from library/mongo

b1d080d9151f: Pull complete 
59a090c1706e: Pull complete 
f53919fe149a: Pull complete 
c269a0ead17c: Pull complete 
26dcb1a49c4a: Pull complete 
b9d2e7e8c9ff: Pull complete 
43acddfebe5b: Pull complete 
510a7c497746: Pull complete 
fefaf29784b7: Pull complete 
2d187f187955: Pull complete 
fe0d7236a147: Pull complete 
bf4514e79915: Pull complete 
d939f57bf29c: Pull complete 
5f9d083f5bfb: Pull complete 
2c273afa05c0: Pull complete 
958ba566c40a: Pull complete 
5e53867deb23: Pull complete 
library/mongo:latest: The image you are pulling has been verified. Important: image verification is a tech preview feature and should not be relied on to provide security.

Digest: sha256:76fdd96ebcdece6a38b4caffc6e2fabf4e1934e944c792269b497f3edfeaa376
Status: Downloaded newer image for mongo:latest
Error response from daemon: Cannot start container 7c052ef5cd148dc94a16a4ae86af79b5bd03fff1a0a45881edddadd773976b01: [8] System error: not a directory
[colin@trymon boot2docker-xhyve (master)]$ 

Workaround:

[colin@trymon boot2docker-xhyve (master)]$ make ssh
[email protected]'s password: 
                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/
 _                 _   ____     _            _
| |__   ___   ___ | |_|___ \ __| | ___   ___| | _____ _ __
| '_ \ / _ \ / _ \| __| __) / _` |/ _ \ / __| |/ / _ \ '__|
| |_) | (_) | (_) | |_ / __/ (_| | (_) | (__|   <  __/ |
|_.__/ \___/ \___/ \__|_____\__,_|\___/ \___|_|\_\___|_|
Boot2Docker version 1.8.1, build xhyve : e9e034e - Fri Sep  4 20:35:54 UTC 2015
Docker version 1.8.1, build d12ea79
docker@boot2docker:~$ sudo rm -rf /etc/localtime/
docker@boot2docker:~$ sudo touch /etc/localtime
docker@boot2docker:~$ ^D
[colin@trymon boot2docker-xhyve (master)]$ docker run -v /etc/localtime:/etc/localtime:ro -it --rm mongo bash
root@3bab6adb227a:/# 

Cannot connect to docker host

I have built boot2docker using the instructions, as well as the Homebrew-provided versions of xhyve and Docker CLI. The VM runs successfully. However, I cannot connect to the VM. make env fails, because to the file /var/db/dhcpd_leases does not exist on my system. Setting DOCKER_HOST to the IP address given by ifconfig inside the VM does not work, as this IP is not visible outside the VM. What can I do?

(I am running OS X El Capitan 10.11.1, if it helps.)

Segfaults on compiling uuid2mac

nlf/dhyve#37 (comment)
nlf/dhyve#37 (comment)

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C uuid2ip
ld uuid2mac.sym
clang-3.6: error: unable to execute command: Segmentation fault: 11
clang-3.6: error: linker command failed due to signal (use -v to see invocation)
make[1]: *** [build/uuid2mac.sym] Error 254
make: *** [uuid2ip/build/uuid2mac] Error 2

Yosemite is 10.10.5 (14F27)

Starting fails

I have installed xhyve and tries to run it, but it fails.

$ sudo ./xhyverun.sh
/Users -network 192.168.64.0 -mask 255.255.255.0 -alldirs -mapall=501:20
sudo nfsd restart
/bin/sh: /usr/sbin/iasl: No such file or directory
                                                  Assertion failed: (error == 0), function main, file src/xhyve.c, line 909.
                                                                                                                            ./xhyverun.sh: line 37:  9782 Abort trap: 6           xhyve $ACPI $MEM $SMP $PCI_DEV $LPC_DEV $NET $IMG_CD $IMG_HDD $UUID -f kexec,$KERNEL,$INITRD,"$CMDLINE"
                                                                                                                              sudo sed -E -e '/^\/Users -network 192.168.64.0 -mask 255.255.255.0 -alldirs -mapall=501:20$/d' -i.bak /etc/exports
                                                                                 sudo nfsd restart

Access docker internal network

Hi, first great project ๐Ÿ‘

In boot2docker using virtualbox if I want access to the the docker internal network 172.17.0.0/16 (default) I can simply create a route on my Mac

sudo route -n add 172.17.0.0/16 $(b2d ip)

If I try the same but with the xhyve VM IP address, but the traffic is not properly routed, for example if I ping a container IP from my Mac I get timeout.

Strangely enough if I look at the packets from the docker container using ifconfig it looks like they are coming through even if they are not really.

Hope it makes sense, I know accessing the docker internal network is not a common thing, but I have my specific use cases.

How to tests this (again this same example works fine using virtualbox/boot2docker):

sudo ./xhyverun.sh
#Login get the IP address

#Run a container
docker run -ti gliderlabs/alpine /bin/sh
#Get the container IP Address

#Add the route on the Mac
sudo route -n add 172.17.0.0/16 THE_VM_IP_ADDRESS

#Ping from the Mac to the container
ping THE_CONTAINER_IP

nameserver 192.168.64.1 on OSX is not working correctly

I don't have access to the internet when I start the machine:

docker@boot2docker:~$ curl google.com
curl: (6) Could not resolve host: google.com

docker@boot2docker:~$ cat /etc/resolv.conf
nameserver 192.168.64.1

docker@boot2docker:~$ echo nameserver 8.8.8.8 > /etc/resolv.conf

docker@boot2docker:~$ curl google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>302 Moved</TITLE></HEAD><BODY>
<H1>302 Moved</H1>
The document has moved
<A HREF="http://www.google.pt/?gfe_rd=cr&amp;ei=IVE7VrfKH_Gr8weGpKTgDw">here</A>.
</BODY></HTML>

But even with the changes above, this still does not work:

docker@boot2docker:~$ docker search ubuntu
Error response from daemon: Get https://index.docker.io/v1/search?q=ubuntu: dial tcp: lookup index.docker.io on 192.168.64.1:53: read udp 192.168.64.1:53: connection refused

Installing cron in boot2docker-xhyve to fix clock drift

From what I can see, there is no cron installed in boot2docker-xhyve, is this correct?

One interesting bug is that the clock drifts while the host machine is asleep; this can cause things like AWS APIs to fail within Docker.

An easy fix is to run sudo ntpclient -s -h pool.ntp.org in the boot2docker VM. Ideally I'd like to put this in a crontab, however without cron in the VM, I am rather at a loss!

Any ideas?

NFS doesn't propagate the file changes?

I noticed that somehow it's possible that files get unsynchronized between the host and the guest, and even more, looks like after the mount files are stored in the guest?

NFS mount a specified path

How do I mount something other than /Users? A command line flag would be good. For example, I use an external disk for all my virtualisation dev work, since my internal disk is too small, so I would like to nfs-mount /Volumes/my-external-disk/somefolder.

Currently, the only way to do this seems to be to edit the last line of vmnet_export.sh. And any path with an extra slash in it (e.g. /Users/fred/somefolder) fails make export-clean.

Something like sudo ./xhyverun.sh --nfs=/Volumes/my-external-disk/somefolder would be awesome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.