add cni plugins

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
This commit is contained in:
Jess Frazelle 2017-10-27 15:05:19 -04:00
parent ee8c9a9892
commit 44cf3c9cc2
No known key found for this signature in database
GPG Key ID: 18F3685C0022BFF3
3 changed files with 32 additions and 0 deletions

View File

@ -1,6 +1,7 @@
# Usage: # Usage:
# docker run --rm -it \ # docker run --rm -it \
# --privileged \ # --privileged \
# --net host \
# -v /var/lib/containers:/var/lib/containers \ # -v /var/lib/containers:/var/lib/containers \
# -v /var/run:/var/run \ # -v /var/run:/var/run \
# -v /dev:/dev \ # -v /dev:/dev \
@ -15,6 +16,7 @@ LABEL maintainer "Jessie Frazelle <jess@linux.com>"
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
btrfs-tools \ btrfs-tools \
ca-certificates \ ca-certificates \
iptables \
libapparmor1 \ libapparmor1 \
libassuan0 \ libassuan0 \
libdevmapper1.02.1 \ libdevmapper1.02.1 \
@ -28,10 +30,12 @@ RUN apt-get update && apt-get install -y \
ENV OSTREE_VERSION v2017.12 ENV OSTREE_VERSION v2017.12
ENV GO_VERSION 1.9.1 ENV GO_VERSION 1.9.1
ENV CNI_PLUGINS_VERSION v0.6.0
ENV RUNC_VERSION v1.0.0-rc4 ENV RUNC_VERSION v1.0.0-rc4
ENV CRIO_VERSION v1.0.0 ENV CRIO_VERSION v1.0.0
# Install ostree # Install ostree
# Install CNI plugins
# Install runc (installs to /sbin/runc) # Install runc (installs to /sbin/runc)
# Install CRI-O (installs to /usr/bin/crio) # Install CRI-O (installs to /usr/bin/crio)
# NOTE: The install docker the templates package is a stop gap for it not being # NOTE: The install docker the templates package is a stop gap for it not being
@ -75,6 +79,13 @@ RUN buildDeps=' \
&& curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xzC /usr/local \ && curl -fsSL "https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xzC /usr/local \
&& export PATH=/go/bin:/usr/local/go/bin:$PATH \ && export PATH=/go/bin:/usr/local/go/bin:$PATH \
&& export GOPATH="$(mktemp -d)" \ && export GOPATH="$(mktemp -d)" \
&& git clone --depth 1 -b "$CNI_PLUGINS_VERSION" https://github.com/containernetworking/plugins.git "${GOPATH}/src/github.com/containernetworking/plugins" \
&& ( \
cd "${GOPATH}/src/github.com/containernetworking/plugins" \
&& ./build.sh \
&& mkdir -p /opt/cni/bin \
&& mv bin/* /opt/cni/bin/ \
) \
&& git clone --depth 1 -b "$RUNC_VERSION" https://github.com/opencontainers/runc.git "${GOPATH}/src/github.com/opencontainers/runc" \ && git clone --depth 1 -b "$RUNC_VERSION" https://github.com/opencontainers/runc.git "${GOPATH}/src/github.com/opencontainers/runc" \
&& ( \ && ( \
cd "${GOPATH}/src/github.com/opencontainers/runc" \ cd "${GOPATH}/src/github.com/opencontainers/runc" \
@ -97,4 +108,6 @@ RUN buildDeps=' \
&& rm -rf "$BUILDPATH" "$GOPATH" "/usr/local/go" \ && rm -rf "$BUILDPATH" "$GOPATH" "/usr/local/go" \
&& apt-get purge -y --auto-remove $buildDeps && apt-get purge -y --auto-remove $buildDeps
COPY net.d /etc/cni/net.d
CMD [ "crio" ] CMD [ "crio" ]

15
crio/net.d/10-mynet.conf Normal file
View File

@ -0,0 +1,15 @@
{
"cniVersion": "0.2.0",
"name": "mynet",
"type": "bridge",
"bridge": "cni0",
"isGateway": true,
"ipMasq": true,
"ipam": {
"type": "host-local",
"subnet": "10.88.0.0/16",
"routes": [
{ "dst": "0.0.0.0/0" }
]
}
}

View File

@ -0,0 +1,4 @@
{
"cniVersion": "0.2.0",
"type": "loopback"
}