Skip to content

Instantly share code, notes, and snippets.

@mcastelino
Last active February 5, 2017 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcastelino/b7acbc044fa409c967a8568008de5732 to your computer and use it in GitHub Desktop.
Save mcastelino/b7acbc044fa409c967a8568008de5732 to your computer and use it in GitHub Desktop.
Clear Container 3.0 test setup using ciao-down
ciao-down is a small utility for setting up a VM that contains everything you need to run ciao's Single VM.
All you need to have installed on your machine is:
Intall go 1.7 or greater on your host system, then
1. go get github.com/01org/ciao/testutil/ciao-down
2. $GOPATH/bin/ciao-down prepare -vmtype clearcontainers
3. $GOPATH/bin/ciao-down connect
Now you can try clear containers inside the VM.
#Setup CNI
mkdir -p $HOME/build
pushd $HOME/build
git clone https://github.com/containernetworking/cni.git
cd cni
./build
sudo mkdir -p /tmp/cni/bin
sudo cp ./bin/bridge /tmp/cni/bin/cni-bridge
sudo cp ./bin/loopback /tmp/cni/bin/loopback
sudo cp ./bin/host-local /tmp/cni/bin/host-local
popd
mkdir -p $HOME/build_hook
pushd $HOME/build_hook
sudo mkdir -p /tmp/bin
go get github.com/containers/virtcontainers
go build -o hook $GOPATH/src/github.com/containers/virtcontainers/hook/mock/hook.go
sudo cp hook /tmp/bin/
popd
sudo mkdir -p /etc/cni/net.d
sudo cp $GOPATH/src/github.com/containers/virtcontainers/test/cni/10-mynet.conf /etc/cni/net.d/
sudo cp $GOPATH/src/github.com/containers/virtcontainers/test/cni/99-loopback.conf /etc/cni/net.d/
sudo mkdir -p /opt/cni/bin
sudo cp /tmp/cni/bin/cni-bridge /opt/cni/bin/
sudo cp /tmp/cni/bin/loopback /opt/cni/bin/
sudo cp /tmp/cni/bin/host-local /opt/cni/bin/
#Setup the pause container
mkdir -p /tmp/bundles/busybox/
docker pull busybox
pushd /tmp/bundles/busybox/
mkdir rootfs
docker export $(docker create busybox) | tar -C rootfs -xvf -
echo -e '#!/bin/sh\ncd "\"\n"sh"' > rootfs/.containerexec
echo -e 'HOME=/root\nPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\nTERM=xterm' > rootfs/.containerenv
cd /tmp/bundles/
mkdir pause_bundle
cp -r busybox/* pause_bundle/
mkdir build_pause
cd build_pause/
wget https://raw.githubusercontent.com/kubernetes-incubator/cri-o/master/pause/pause.c
wget https://raw.githubusercontent.com/kubernetes-incubator/cri-o/master/pause/Makefile
make
cd /tmp/bundles/
cp build_pause/pause pause_bundle/rootfs/bin/
popd
sudo cp /tmp/bundles/build_pause/pause /usr/bin/
#Setup the hooks
cd $GOPATH/src/github.com/containers/virtcontainers
pushd hook/mock
go build
sudo mkdir -p /tmp/bin/
sudo cp mock /tmp/bin/hook
popd
@gorozco1
Copy link

missing in L#45
go get github.com/containers/virtcontainers

missing sudo in L#83

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment