Skip to content

Instantly share code, notes, and snippets.

@kubicek
Last active September 2, 2020 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kubicek/50c014649c337516baf17f45ecc407c3 to your computer and use it in GitHub Desktop.
Save kubicek/50c014649c337516baf17f45ecc407c3 to your computer and use it in GitHub Desktop.
FreeBSD docker
pkg install vm-bhyve
zfs create zroot/vm
mkdir /var/vm
zfs set mountpoint=/var/vm zroot/vm
sysrc vm_enable=YES
sysrc vm_dir=zfs:zroot/vm
sysrc vm_list=debian
vm init
cp /usr/local/share/examples/vm-bhyve/* /usr/local/share/examples/vm-bhyve/windows.conf /var/vm/.templates/
sysrc gateway_enable=yes
sysrc pf_enable=yes
echo "nat on bce0 from {192.168.8.0/24} to any -> (bce0) /etc/pf.conf" >> /etc/pf.conf
echo "sysctl net.inet.ip.forwarding=1" >> /etc/sysctl.conf
sysctl net.inet.ip.forwarding=1
service pf start
pkg install dnsmasq
"port=0
domain-needed
no-resolv
except-interface=lo0
bind-interfaces
local-service
dhcp-authoritative
interface=vm-public
dhcp-range=192.168.8.10,192.168.8.254" >> /usr/local/etc/dnsmasq.conf
sudo sysrc dnsmasq_enable="YES"
sudo service dnsmasq start
vm switch create -a 192.168.8.1/24 public
vm switch address public 192.168.8.1/24
vm create -t debian -s 20G debian
vm iso https://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-10.4.0-amd64-netinst.iso
pkg install grub2-bhyve
vm install debian debian-10.4.0-amd64-netinst.iso
vm console debian
apt-get update
apt-get install net-tools telnet
apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
apt-key fingerprint 0EBFCD88
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt-get update
apt-get install docker-ce docker-ce-cli containerd.io
#apt-cache madison docker-ce
#apt-get install docker-ce=<VERSION_STRING> docker-ce-cli=<VERSION_STRING> containerd.io
docker run hello-world
docker volume create portainer_data
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment