docker-machine-driver-bhyve
docker-machine-driver-bhyve copied to clipboard
Docker Machine driver for Bhyve
What is this
This is a Docker Machine Driver for Bhyve. It is heavily inspired by the xhyve driver, the generic driver and the VirtualBox driver. See also this issue.
Requirements
You must be running a version of FreeBSD which includes this commit. As of now (2019/08/16), this is only in FreeBSD-CURRENT.
How To Use It
One time setup
-
Install required packages:
-
sudo
-
grub2-bhyve
-
dnsmasq
-
-
User running
docker-machine
must have password-lesssudo
access to the following commands:-
/sbin/ifconfig
-
/sbin/sysctl
-
/usr/bin/env
-
/usr/bin/fuser
-
/usr/local/sbin/dnsmasq
-
/usr/local/sbin/grub-bhyve
-
/usr/sbin/bhyve
-
/usr/sbin/bhyvectl
-
/usr/sbin/ngctl
-
echo 'jsmith ALL=(ALL) NOPASSWD: ALL' >> /usr/local/etc/sudoers
- Add user to wheel group:
pw groupmod wheel -m jsmith
- Add these lines to
/etc/devfs.rules
:
[system=10]
add path 'nmdm*' mode 0660
-
Set
devfs_system_ruleset="system"
in/etc/rc.conf
and runservice devfs restart
-
Add
ng_ether
,nmdm
andvmm
tokld_list
in/etc/rc.conf
,kldload ng_ether
,kldload vmm
,kldload nmdm
.
Build
make
Setup
export MACHINE_DRIVER=bhyve
export PATH=${PATH}:${PWD}
Normal usage
docker-machine create
eval $(docker-machine env)
docker run --rm hello-world
Note about bridges
If the interface where the NAT IP is assigned is a member of another bridge, the NAT will fail
Note about nat
Local IPv4 breaks because all inbound traffic is forwarded to the docker-machine VM