[Midnightbsd-cvs] mports [21357] trunk/sysutils: add docker-freebsd port.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sun Apr 3 13:44:12 EDT 2016


Revision: 21357
          http://svnweb.midnightbsd.org/mports/?rev=21357
Author:   laffer1
Date:     2016-04-03 13:44:11 -0400 (Sun, 03 Apr 2016)
Log Message:
-----------
add docker-freebsd port. This is a rough port of part of docker to freebsd from 2015. No guarantees on how well this works.

Modified Paths:
--------------
    trunk/sysutils/Makefile

Added Paths:
-----------
    trunk/sysutils/docker-freebsd/
    trunk/sysutils/docker-freebsd/Makefile
    trunk/sysutils/docker-freebsd/distinfo
    trunk/sysutils/docker-freebsd/files/
    trunk/sysutils/docker-freebsd/files/docker.in
    trunk/sysutils/docker-freebsd/pkg-descr
    trunk/sysutils/docker-freebsd/pkg-message

Modified: trunk/sysutils/Makefile
===================================================================
--- trunk/sysutils/Makefile	2016-04-03 17:38:33 UTC (rev 21356)
+++ trunk/sysutils/Makefile	2016-04-03 17:44:11 UTC (rev 21357)
@@ -24,6 +24,7 @@
 SUBDIR += devcpu-data
 SUBDIR += dirdiff
 SUBDIR += dmidecode
+SUBDIR += docker-freebsd
 SUBDIR += dvd+rw-tools
 SUBDIR += dvdbackup
 SUBDIR += e2fsprogs

Added: trunk/sysutils/docker-freebsd/Makefile
===================================================================
--- trunk/sysutils/docker-freebsd/Makefile	                        (rev 0)
+++ trunk/sysutils/docker-freebsd/Makefile	2016-04-03 17:44:11 UTC (rev 21357)
@@ -0,0 +1,39 @@
+# Created by: kmoore at FreeBSD.org
+# $FreeBSD: head/sysutils/docker-freebsd/Makefile 407239 2016-01-25 20:23:57Z rakuco $
+# $MidnightBSD$
+
+PORTNAME=	docker-freebsd
+PORTVERSION=	20150625
+CATEGORIES=	sysutils
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	Docker containment system
+
+LICENSE=	apache2
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	go>=1.4:${PORTSDIR}/lang/go \
+		bash:${PORTSDIR}/shells/bash \
+		sqlite3:${PORTSDIR}/databases/sqlite3
+RUN_DEPENDS=	go>=1.4:${PORTSDIR}/lang/go \
+		bash:${PORTSDIR}/shells/bash \
+		sqlite3:${PORTSDIR}/databases/sqlite3
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	kvasdopil
+GH_PROJECT=	docker
+GH_TAGNAME=	582db78
+
+WRKSRC=		${WRKDIR}/docker-${GH_TAGNAME}
+
+PLIST_FILES=	bin/docker
+USE_RC_SUBR=	docker
+
+do-build:
+	@cd ${WRKSRC} && export AUTO_GOPATH=1 && export DOCKER_GITCOMMIT=${GH_TAGNAME} && ./hack/make.sh binary
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_PROGRAM} ${WRKSRC}/bundles/latest/binary/docker ${STAGEDIR}${PREFIX}/bin/
+
+.include <bsd.port.mk>


Property changes on: trunk/sysutils/docker-freebsd/Makefile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sysutils/docker-freebsd/distinfo
===================================================================
--- trunk/sysutils/docker-freebsd/distinfo	                        (rev 0)
+++ trunk/sysutils/docker-freebsd/distinfo	2016-04-03 17:44:11 UTC (rev 21357)
@@ -0,0 +1,2 @@
+SHA256 (docker-freebsd-20150625_GH0.tar.gz) = a750d344af4af3d30b1a3373f382ab597a2a7aa4a0bb5c22d650d0c5cc9ac506
+SIZE (docker-freebsd-20150625_GH0.tar.gz) = 7292884


Property changes on: trunk/sysutils/docker-freebsd/distinfo
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sysutils/docker-freebsd/files/docker.in
===================================================================
--- trunk/sysutils/docker-freebsd/files/docker.in	                        (rev 0)
+++ trunk/sysutils/docker-freebsd/files/docker.in	2016-04-03 17:44:11 UTC (rev 21357)
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+# PROVIDE: docker
+# REQUIRE: DAEMON
+# KEYWORD: nojail shutdown
+
+. /etc/rc.subr
+
+name="docker"
+rcvar="docker_enable"
+
+stop_cmd="docker_stop"
+start_cmd="docker_start"
+command="%%PREFIX%%/bin/docker"
+
+load_rc_config $name
+
+: ${docker_enable=NO}
+: ${docker_dir=/usr/docker}
+: ${docker_nat_pf=YES}
+: ${docker_nat_iface=NONE}
+
+docker_start()
+{
+	if [ ! -d "${docker_dir}" ] ; then
+		echo "Missing ${docker_dir}! Please create / mount a ZFS dataset at this location."
+		exit 1
+	fi
+
+	if [ -e "/var/run/docker.pid" ] ; then
+		pgrep -F /var/run/docker.pid 2>/dev/null >/dev/null
+		if [ $? -eq 0 ] ; then
+			echo "Docker already running? /var/run/docker.pid"
+			exit 1
+		fi
+	fi
+
+	echo "Starting docker..."
+	daemon -p /var/run/docker.pid ${command} -d -e jail -s zfs -g ${docker_dir} -D >/var/log/docker.log 2>/var/log/docker.log
+
+	# Check for linux 64bit support and enable
+	kldstat | grep -q 'linux64'
+	if [ $? -ne 0 -a -e "/boot/kernel/linux64.ko" ] ; then
+		kldload linux64
+	fi
+
+	# Check for NAT support via PF
+	# This is an ugly experimental hack for now, eventually will go away
+	if [ "${docker_nat_pf}" != "YES" ] ; then return ; fi
+
+	# Load PF if not already
+	kldstat | grep -q 'pf.ko'
+	if [ $? -ne 0 -a -e "/boot/kernel/pf.ko" ] ; then
+		kldload pf
+	fi
+
+	# Check if PF rules already loaded
+	/sbin/pfctl -s nat 2>/dev/null | grep -q 172.17
+	if [ $? -eq 0 ] ; then return ; fi
+
+	if [ "${docker_nat_iface}" != "NONE" ] ; then
+		iface="${docker_nat_iface}"
+	else
+		iface=`/usr/bin/netstat -f inet -nrW | grep '^default' | awk '{ print $6 }'`
+	fi
+	echo "nat on ${iface} from 172.17.0.0/16 to any -> (${iface})" > /tmp/pf-nat-docker.$$
+	/sbin/pfctl -f /tmp/pf-nat-docker.$$ 2>/dev/null
+	/sbin/pfctl -e 2>/dev/null
+	rm /tmp/pf-nat-docker.$$
+
+}
+
+docker_stop()
+{
+	if [ -e "/var/run/docker.pid" ] ; then
+		echo "Stopping docker..."
+		pkill -F /var/run/docker.pid
+	fi
+}
+
+run_rc_command "$1"
+


Property changes on: trunk/sysutils/docker-freebsd/files/docker.in
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sysutils/docker-freebsd/pkg-descr
===================================================================
--- trunk/sysutils/docker-freebsd/pkg-descr	                        (rev 0)
+++ trunk/sysutils/docker-freebsd/pkg-descr	2016-04-03 17:44:11 UTC (rev 21357)
@@ -0,0 +1,12 @@
+Docker is an open source project to pack, ship and run any
+application as a lightweight container.
+
+Docker containers are both hardware-agnostic and platform-agnostic.
+This means they can run anywhere, from your laptop to the largest
+EC2 compute instance and everything in between - and they don't
+require you to use a particular language, framework or packaging
+system. That makes them great building blocks for deploying and
+scaling web apps, databases, and backend services without depending
+on a particular stack or provider.
+
+WWW: https://github.com/kvasdopil/docker


Property changes on: trunk/sysutils/docker-freebsd/pkg-descr
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/sysutils/docker-freebsd/pkg-message
===================================================================
--- trunk/sysutils/docker-freebsd/pkg-message	                        (rev 0)
+++ trunk/sysutils/docker-freebsd/pkg-message	2016-04-03 17:44:11 UTC (rev 21357)
@@ -0,0 +1,21 @@
+
+Docker requires a bit of setup before usage. 
+
+You will need to create a ZFS dataset on /usr/docker
+
+# zfs create -o mountpoint=/usr/docker <zroot>/docker 
+
+And lastly enable the docker daemon
+# sysrc -f /etc/rc.conf docker_enable="YES"
+# service docker start
+
+(WARNING)
+
+Starting the docker service will also add the following PF rule:
+
+nat on ${iface} from 172.17.0.0/16 to any -> (${iface})
+
+Where $iface is the default NIC on the system, or the value
+of $docker_nat_iface. This is for network connectivity to docker
+containers in this early port. This should not be needed in future
+versions of docker. 


Property changes on: trunk/sysutils/docker-freebsd/pkg-message
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list