@@ -79,3 +79,4 @@ testsuite.tmp.orig
/Documentation/_build
/.venv
/cxx-check
+*.mod
@@ -510,28 +510,29 @@ For ovs vswitchd, we need to load ovs kernel modules on host.
Hence, OVS containers kernel version needs to be same as that of host kernel.
-Export following variables in .env and place it under
-project root::
+If you want to change the default values for building an image then set these
+variables::
- $ OVS_BRANCH=<BRANCH>
- $ OVS_VERSION=<VERSION>
- $ DISTRO=<LINUX_DISTRO>
- $ KERNEL_VERSION=<LINUX_KERNEL_VERSION>
- $ GITHUB_SRC=<GITHUB_URL>
- $ DOCKER_REPO=<REPO_TO_PUSH_IMAGE>
+ $ export OVS_BRANCH=<BRANCH>
+ $ export OVS_VERSION=<VERSION>
+ $ export DISTRO=<LINUX_DISTRO>
+ $ export KERNEL_VERSION=<LINUX_KERNEL_VERSION>
+ $ export GITHUB_SRC=<GITHUB_URL>
+ $ export DOCKER_REPO=<REPO_TO_PUSH_IMAGE>
+ $ export DOCKER_TAG=<DOCKER_IMAGE_TAG>
-To build ovs modules::
+To setup for using a local registry (localhost:5000)::
- $ cd utilities/docker
- $ make build
+ $ make docker-registry
+ $ export DOCKER_REPO=localhost:5000/ovsvswitch/ovs
-Compiled Modules will be tagged with docker image
+To build ovs modules (tagged with docker image)::
-To Push ovs modules::
+ $ make docker-build
- $ make push
+To push ovs modules to docker repo::
-OVS docker image will be pushed to specified docker repo.
+ $ make docker-push
Start ovsdb-server using below command::
@@ -499,3 +499,4 @@ include datapath-windows/include/automake.mk
include windows/automake.mk
include selinux/automake.mk
include build-aux/automake.mk
+include utilities/docker/automake.mk
@@ -56,7 +56,7 @@ EXTRA_DIST += \
utilities/ovs-vlan-test.in \
utilities/ovs-vsctl-bashcomp.bash \
utilities/checkpatch.py \
- utilities/docker/Makefile \
+ utilities/docker/automake.mk \
utilities/docker/ovs-override.conf \
utilities/docker/start-ovs \
utilities/docker/create_ovs_db.sh \
new file mode 100644
@@ -0,0 +1,2 @@
+vswitch.ovsschema
+ovsdb-tool
deleted file mode 100644
@@ -1,22 +0,0 @@
-#export OVS_BRANCH=branch-2.11
-#export OVS_VERSION=2.11
-#export KERNEL_VERSION=4.15.0-54-generic
-#export DISTRO=debian
-#export GITHUB_SRC=https://github.com/openvswitch/ovs.git
-#export DOCKER_REPO=openvswitch/ovs
-
-# Example:
-# make build
-# make push
-
-REPO = ${DOCKER_REPO}
-tag = ${OVS_VERSION}_${DISTRO}_${KERNEL_VERSION}
-
-build: ;docker build -t ${REPO}:${tag} --build-arg DISTRO=${DISTRO} \
---build-arg OVS_BRANCH=${OVS_BRANCH} \
---build-arg KERNEL_VERSION=${KERNEL_VERSION} \
---build-arg GITHUB_SRC=${GITHUB_SRC} -f ${DISTRO}/Dockerfile .
-
-.PHONY: build
-
-push: ;docker push ${REPO}:${tag}
new file mode 100644
@@ -0,0 +1,40 @@
+DIR := utilities/docker
+
+OVS_BRANCH ?= branch-2.11
+OVS_VERSION ?= 2.11
+KERNEL_VERSION ?= 4.15.0-54-generic
+DISTRO ?= debian
+GITHUB_SRC ?= https://github.com/openvswitch/ovs.git
+DOCKER_REPO ?= openvswitch/ovs
+DOCKER_TAG ?= ${OVS_VERSION}_${DISTRO}_${KERNEL_VERSION}
+DOCKER_SERVER ?= localhost:5000
+
+.PHONY: docker-registry
+docker-registry:
+ docker rm --force registry 2>/dev/null || true
+ docker run -d -p 5000:5000 --restart=always --name registry registry:2
+ @echo
+ @echo "# For using local repo set:"
+ @echo "export DOCKER_REPO=localhost:5000/openvswitch/ovs"
+ @echo
+ @echo "# For returning to public repo set:"
+ @echo "export DOCKER_REPO=openvswitch/ovs"
+
+$(DIR)/vswitch.ovsschema: vswitchd/vswitch.ovsschema
+ cp $< $@
+
+$(DIR)/ovsdb-tool: ovsdb/ovsdb-tool
+ cp $< $@
+
+.PHONY: docker-build
+docker-build: $(DIR)/vswitch.ovsschema $(DIR)/ovsdb-tool
+ cd $(DIR) && docker build -t ${DOCKER_REPO}:${DOCKER_TAG} \
+ --build-arg DISTRO=${DISTRO} \
+ --build-arg OVS_BRANCH=${OVS_BRANCH} \
+ --build-arg KERNEL_VERSION=${KERNEL_VERSION} \
+ --build-arg GITHUB_SRC=${GITHUB_SRC} \
+ -f ${DISTRO}/Dockerfile .
+
+.PHONY: docker-push
+docker-push:
+ cd $(DIR) && docker push ${DOCKER_REPO}:${DOCKER_TAG}
@@ -6,14 +6,15 @@ ARG KERNEL_VERSION
ARG GITHUB_SRC
ARG DISTRO
-copy $DISTRO/build-kernel-modules.sh /build-kernel-modules.sh
+COPY $DISTRO/build-kernel-modules.sh /build-kernel-modules.sh
RUN /build-kernel-modules.sh $KERNEL_VERSION $OVS_BRANCH $GITHUB_SRC
+COPY vswitch.ovsschema /usr/share/openvswitch/vswitch.ovsschema
+COPY ovsdb-tool /bin/ovsdb-tool
COPY create_ovs_db.sh /etc/openvswitch/create_ovs_db.sh
RUN /etc/openvswitch/create_ovs_db.sh
COPY ovs-override.conf /etc/depmod.d/openvswitch.conf
-
COPY start-ovs /bin/start-ovs
VOLUME ["/var/log/openvswitch", "/var/lib/openvswitch",\
"/var/run/openvswitch", "/etc/openvswitch"]
Add a set of docker targets which ease the building and testing of docker images both on local registry (localhost:5000) as well as on the public default registry (docker.io). Signed-off-by: Aidan Shribman <aidan.shribman@gmail.com> --- .gitignore | 1 + Documentation/intro/install/general.rst | 31 +++++++++---------- Makefile.am | 1 + utilities/automake.mk | 2 +- utilities/docker/.gitignore | 2 ++ utilities/docker/Makefile | 22 -------------- utilities/docker/automake.mk | 40 +++++++++++++++++++++++++ utilities/docker/debian/Dockerfile | 5 ++-- 8 files changed, 64 insertions(+), 40 deletions(-) create mode 100644 utilities/docker/.gitignore delete mode 100644 utilities/docker/Makefile create mode 100644 utilities/docker/automake.mk