Skip to content

Instantly share code, notes, and snippets.

@ekesken
Last active August 17, 2016 19:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ekesken/b193efba45676cdbdf6f79e8e0ad627b to your computer and use it in GitHub Desktop.
Save ekesken/b193efba45676cdbdf6f79e8e0ad627b to your computer and use it in GitHub Desktop.
libnetwork_plugin_issue_60
docker build -t libnetwork_plugin_issue_60 .
docker run --privileged --rm libnetwork_plugin_issue_60
to debug:
docker run --privileged --rm -it --entrypoint=/bin/bash libnetwork_plugin_issue_60
root@XXXX:/# . /entrypoint.sh
FROM ubuntu:16.04
RUN apt-get update && apt-get --yes --no-install-recommends install \
curl libltdl7 iptables python-dev git python-setuptools python-pip gcc iproute2
RUN easy_install --upgrade pip
RUN curl -Ok https://apt.dockerproject.org/repo/pool/main/d/docker-engine/docker-engine_1.12.0-0~xenial_amd64.deb
RUN dpkg -i docker-engine_1.12.0-0~xenial_amd64.deb
RUN echo 'DOCKER_OPTS="-D --cluster-store=etcd://localhost:2379"' >> /etc/default/docker
RUN curl -Lk https://github.com/coreos/etcd/releases/download/v2.3.7/etcd-v2.3.7-linux-amd64.tar.gz | tar zx -C /usr/local/
RUN ln -s /usr/local/etcd-v2.3.7-linux-amd64/etcd /usr/local/bin/etcd
RUN ln -s /usr/local/etcd-v2.3.7-linux-amd64/etcdctl /usr/local/bin/etcdctl
RUN git config --global http.sslVerify false
RUN git clone --branch v0.8.0 https://github.com/projectcalico/libnetwork-plugin.git /usr/local/libnetwork-plugin
RUN pip install -r /usr/local/libnetwork-plugin/requirements.txt
RUN curl -Lko /usr/local/bin/calicoctl https://www.projectcalico.org/builds/calicoctl/
RUN chmod +x /usr/local/bin/calicoctl
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
#!/bin/bash
export ETCD_AUTHORITY=localhost:2379
export ETCD_SCHEME=http
mkdir -p /run/docker/plugins
etcd &
/usr/local/bin/gunicorn \
--chdir /usr/local/libnetwork-plugin \
-b unix:///run/docker/plugins/calico.sock \
libnetwork.driver_plugin:app \
--timeout 5 \
--log-level=info \
--workers 1 \
--worker-class gevent \
--access-logfile - &
service docker start
calicoctl pool add 172.35.0.0/16 --ipip --nat-outgoing
docker network create --driver calico --ipam-driver calico --subnet=172.35.0.0/16 calico-net1
/usr/bin/docker run \
--name=calico-node \
--net=host \
--privileged \
--name=calico-node \
-e CALICO_NETWORKING=true \
-e ETCD_AUTHORITY=localhost:2379 \
-e ETCD_SCHEME=http \
-v /var/log/calico:/var/log/calico \
-v /lib/modules:/lib/modules \
-v /var/run/calico:/var/run/calico \
-d calico/node:v0.20.0
/usr/bin/docker run --rm --net=calico-net1 busybox ip a s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment