-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Ubuntu 14.04 Mint17 and runc
- Draft (please review)
mkdir -p gocode/github.com/opencontainers
export GOPATH=$(pwd)/gocode
export PATH=${PATH}:${GOPATH}/bin
cd gocode/github.com/opencontainers
git clone https://github.com/opencontainers/runc
# Hack in a link to libcontainer in runc's checkout
cd runc/Godeps/_workspace/src/github.com/opencontainers/
mkdir -p runc
cd runc
ln -s ../../../../../../libcontainer libcontainer
cd ${GOPATH}/github.com/opencontainers/runc
make
sudo make install
running golang with golang path set and golang-bin path set … (if not yet done ... follow this short introduction)
mkdir -pv ~/gocode/github.com/
vim ~/.profile
add these two lines (fitting to your need)
export GOPATH=~/gocode
export PATH=$PATH:$GOPATH/bin
check out also FIX 2 down below (to install latest Golang)
create a ‘github.com/opencontainers’ in your GOPATH
cd github.com/opencontainers
git clone https://github.com/opencontainers/runc
cd runc
make
sudo make install
Now I had some Issues with Linux Mint17 and Ubuntu 14.04, while building runc … and here are small workarounds to fix them:
torbatux@torbuntu:~/gocode/github.com/opencontainers/runc$ make
go build -o runc .
checkpoint.go:11:2: cannot find package “github.com/opencontainers/runc/libcontainer” in any of:
/usr/lib/go/src/pkg/github.com/opencontainers/runc/libcontainer (from $GOROOT)
/home/torbatux/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer (from $GOPATH)
/home/torbatux/gocode/src/github.com/opencontainers/runc/libcontainer
spec_linux.go:13:2: cannot find package “github.com/opencontainers/runc/libcontainer/cgroups” in any of:
/usr/lib/go/src/pkg/github.com/opencontainers/runc/libcontainer/cgroups (from $GOROOT)
/home/torbatux/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/cgroups (from $GOPATH)
/home/torbatux/gocode/src/github.com/opencontainers/runc/libcontainer/cgroups
restore.go:13:2: cannot find package “github.com/opencontainers/runc/libcontainer/configs” in any of:
/usr/lib/go/src/pkg/github.com/opencontainers/runc/libcontainer/configs (from $GOROOT)
/home/torbatux/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/configs (from $GOPATH)
/home/torbatux/gocode/src/github.com/opencontainers/runc/libcontainer/configs
spec_linux.go:15:2: cannot find package “github.com/opencontainers/runc/libcontainer/devices” in any of:
/usr/lib/go/src/pkg/github.com/opencontainers/runc/libcontainer/devices (from $GOROOT)
/home/torbatux/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/devices (from $GOPATH)
/home/torbatux/gocode/src/github.com/opencontainers/runc/libcontainer/devices
main_unix.go:5:8: cannot find package “github.com/opencontainers/runc/libcontainer/nsenter” in any of:
/usr/lib/go/src/pkg/github.com/opencontainers/runc/libcontainer/nsenter (from $GOROOT)
/home/torbatux/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/nsenter (from $GOPATH)
/home/torbatux/gocode/src/github.com/opencontainers/runc/libcontainer/nsenter
restore.go:14:2: cannot find package “github.com/opencontainers/runc/libcontainer/utils” in any of:
/usr/lib/go/src/pkg/github.com/opencontainers/runc/libcontainer/utils (from $GOROOT)
/home/torbatux/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/utils (from $GOPATH)
/home/torbatux/gocode/src/github.com/opencontainers/runc/libcontainer/utils
make: *** [all] Error 1
torbatux@torbuntu:~/gocode/github.com/opencontainers/runc$ cd Godeps/_workspace/src/github.com/
torbatux@torbuntu:~/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com$ ls
Sirupsen codegangsta coreos docker godbus golang syndtr
torbatux@torbuntu:~/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com$ mkdir opencontainers
torbatux@torbuntu:~/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com$ cd opencontainers/
torbatux@torbuntu:~/gocode/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers$ git clone https://github.com/opencontainers/runc
Cloning into ‘runc’…
done
cd $GOPATH/github.com/opencontainers/runc/
make
Symlinking $GOPATH/github.com/opencontainers/runc/Godeps/_workspace/src/github.com/opencontainers/libcontainer to $GOPATH/github.com/opencontainers/runc/libcontainer will also work.
torbatux@torbuntu:~/gocode/github.com/opencontainers/runc$ make
go build -o runc .
github.com/opencontainers/runc/libcontainer/seccomp
Godeps/_workspace/src/github.com/opencontainers/runc/libcontainer/seccomp/seccomp.go:71: internal compiler error: unknown etype 0/STRUCT
make: *** [all] Error 2
PROBLEM is go version 1.2 / 1.2.1 which is the default in Mint 17/Ubuntu 14.04 (tested on both)
sudo apt-get remove golang golang-tools
sudo su
cd /usr/local/
wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
tar -C /usr/local -xzf go1.4.2.linux-amd64.tar.g
rm go1.4.2.linux-amd64.tar.gz
vim /etc/profile
# put inside:
export PATH=$PATH:/usr/local/go/bin
—- Logout / Login … its working afterwards … —-
But now Docker is to old … so
sudo apt-get update -y && sudo apt-get upgrade -y
sudo sh -c “echo deb https://get.docker.io/ubuntu docker main >/etc/apt/sources.list.d/docker.list”
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
sudo apt-get -y update
sudo apt-get install -y lxc-docker
docker version
docker pull ubuntu:latest
docker export $(docker create ubuntu) > ubuntu_latest.tar
mkdir rootfs
tar -C rootfs -xf ubuntu_latest.tar
vim config.json
{
“version”: “0.1.1”,
“platform”: {
“os”: “linux”,
“arch”: “amd64″
},
“process”: {
“terminal”: true,
“user”: “daemon”,
“args”: [
“sh”
],
“env”: [
“PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin”,
“TERM=xterm”
],
“cwd”: “”
},
“root”: {
“path”: “rootfs”,
“readonly”: true
},
“hostname”: “shell”,
“mounts”: [
{
“type”: “proc”,
“source”: “proc”,
“destination”: “/proc”,
“options”: “”
},
{
“type”: “tmpfs”,
“source”: “tmpfs”,
“destination”: “/dev”,
“options”: “nosuid,strictatime,mode=755,size=65536k”
},
{
“type”: “devpts”,
“source”: “devpts”,
“destination”: “/dev/pts”,
“options”: “nosuid,noexec,newinstance,ptmxmode=0666,mode=0620,gid=5″
},
{
“type”: “tmpfs”,
“source”: “shm”,
“destination”: “/dev/shm”,
“options”: “nosuid,noexec,nodev,mode=1777,size=65536k”
},
{
“type”: “mqueue”,
“source”: “mqueue”,
“destination”: “/dev/mqueue”,
“options”: “nosuid,noexec,nodev”
},
{
“type”: “sysfs”,
“source”: “sysfs”,
“destination”: “/sys”,
“options”: “nosuid,noexec,nodev”
}
],
“linux”: {
“namespaces”: [
{
“type”: “process”
},
{
“type”: “network”
},
{
“type”: “mount”
},
{
“type”: “ipc”
},
{
“type”: “uts”
}
],
“capabilities”: [
“AUDIT_WRITE”,
“KILL”,
“NET_BIND_SERVICE”
],
“devices”: [
“null”,
“random”,
“full”,
“tty”,
“zero”,
“urandom”
]
}
}
Start first time:
sudo runc
now you can check if you are inside of runc