Skip to content

leafoliage/freebsd-dockerbox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FreeBSD-Dockerbox

Note

This project is still a work in progress.

Dockerbox provides docker on FreeBSD by running dockerd inside a Linux Bhyve VM.

Project Structure

This repository (freebsd-docker) holds the core files to run the dockerbox service, including rc script and configs.

freebsd-dockerbox-debian is the repository for dockerbox's underlying disk images.

freebsd-dockerbox-port holds dockerbox's port related files.

Children Service

Children services are optional, but they improve dockerbox usability. It is recommended to install them, too.

They are automatically started by dockerbox in dockerbox poststart command if enabled.

  • dockerbox-broker
    • Maintains port forwarding from localhost to remote TCP docker host for ports binded on the remote host

Quickstart

Install from source

To install from source, clone this repository and run make install.

git clone https://github.com/leafoliage/freebsd-dockerbox.git
make install

Download the dockerbox disk image.

make fetch-disk

Install helper packages.

pkg install grub2-bhyve e2fsprogs docker-cli docker-compose

There is a recent patch to grub2-bhve and docker-compose; docker would be renamed to docker-cli. Please make sure the "latest" package repository is used instead of quarterly. Check with pkg -vv. Otherwise, grub2-bhyve should be built from port.

Enable and start the dockerbox service.

sysrc dockerbox_enable=YES
service dockerbox enable
service dockerbox start

Run docker command with remote docker specified.

docker -H 10.0.0.1:2375 run hello-world

Install from port

See freebsd-dockerbox-port Quickstart.

Usage

Starting dockerbox.

service dockerbox start

Setup docker context for dockerbox.

docker context create dockerbox --docker "host=ssh://dockerbox@10.0.0.1"
docker context use dockerbox

Altervatively, for one-shot use.

docker -H tcp://10.0.0.1:2375 ps
export DOCKER_HOST=tcp://10.0.0.1:2375; docker ps

Docker run.

docker run hello-world

Stopping dockerbox.

service dockerbox stop

Resize docker data storage.

dockerbox resize 1G

Currently only extending storage is supported.

Access dockerbox console with dockerbox built in console command or ssh.

dockerbox console
ssh dockerbox@10.0.0.1

Log is at /var/log/dockerbox.log

Advanced Usages

Refer to the wiki for advanced usages:

Upgrade dockerbox root disk

Make sure new version of sbin/dockerbox is installed, then upgrade root disk. It would prompt for permission to replace old disk, enter 'y' to proceed.

dockerbox fetch

Configs

  • Default config
# /usr/local/etc/dockerbox/dockerbox.conf
cpu=1
memory=1024M
ext_if=auto
nat_ip=10.0.0.254
nat_mask=24
console=yes
start_wait_timeout=30

Refer to wiki/Configuration for details.

Dockerbox Structure

Dockerbox runs on a root disk and a docker data disk. The docker data disk is mounted at /var/lib/docker, and the rest of they system is installed on the root disk. The separate disk design is to simplify disk space management and resizing.

About

Use Linux to drive your dockerd (Inspired by pgj/freebsd-wifibox)

Topics

Resources

License

Stars

Watchers

Forks

Contributors