Add Instructions for Running Tools From Scratch
Below are the steps I took (with help from Stephe Walli) to run the OCI Runtime-Tools on a freshly created Ubuntu VM.
It would be great to have someone give this a quick try and comment with: (a) Does this work for you? (Hopefully yes :) ) (b) Are there any ways this could be simplified?
Thanks-- --Rob
-
Create a new VM
-
Check to see if you have git, go, and curl installed:
- git: git --version
- curl: curl --version
- go: go --version
1.1. Install Git if you don't have it // TODO
1.2. Install Curl
1.3. Install Go if you don't have it: curl -O https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.6.3.linux-amd64.tar.gz // Add the following to .profile // set -o vi // export PATH=$PATH:/usr/local/go/bin // export GOPATH=$HOME/work
-
Set-up Directories: mkdir work cd work mkdir src cd src mkdir github.com cd github.com mkdir RobDolinMS (or your GitHub alias) cd RobDolinMS cd .. mkdir opencontainers cd opencontainers
-
Clone the runc and runtime-tools repos: git clone https://github.com/openconainers/runc git clone https://github.com/opencontainers/runtime-tools
-
Build runc: sudo apt-get install make cd runc sudo apt-get build-essential sudo apt-get install pkg-config sudo apt-get install libseccomp-dev make // You've just built runc! Woo! sudo make install which runc runc --version
-
Get Runtime-Tools dependencies: cd runtime-tools go get github.com/russross/blackfriday go install github.com/russross/blackfriday go get github.com/cpuguy83/go-md2man go install github.com/cpuguy83/go-md2man sudo install -m 755 $GOPATH/bin/go-md2man /usr/bin
-
Build Runtime-Tools: sudo make install // You have now built the runtime tools! Woo!
-
Run the runtime tools against runc: sudo ./test_runtime.sh -r runc -l debug
On Fri, Dec 02, 2016 at 11:30:07AM -0800, Rob Dolin (MSFT) wrote:
1.1. Install Git if you don't have it // TODO
For Debian/Ubuntu, this will be just ‘apt-get install git’. To be more generic, I'd link to 1, which has binaries for OS X and Windows, and package-manger instructions for a whole host of *nixes 2
// Add the following to .profile // set -o vi // export PATH=$PATH:/usr/local/go/bin // export GOPATH=$HOME/work
Without comments:
$ cat >.profile <<EOF
set -o vi export PATH=$PATH:/usr/local/go/bin export GOPATH=$HOME/work EOF
Although the PS2 prompts mean that's not copy/paste-able. And I think it would be more idiomatic to use ~/.local/lib/go for GOPATH. I also set GOBIN to ~/.local/bin 3 and auto-inject that into my PATH 4.
- Set-up Directories:
‘go get …’ should do this for you.
- Clone the runc and runtime-tools repos: git clone https://github.com/openconainers/runc
Building runC should be orthogonal to building runtime-tools. I think docs about setting it up belong in runC itself.
git clone https://github.com/opencontainers/runtime-tools
‘go get …’ will do this too. It crashes because it doesn't understand our vendored deps, but that's not a big deal:
$ export GOPATH=/tmp/whatever $ go get github.com/opencontainers/runtime-tools/cmd/oci-runtime-tool
github.com/opencontainers/runtime-tools/generate/seccomp
/tmp/whatever/src/github.com/opencontainers/runtime-tools/generate/seccomp/parse_action.go:23: undefined: specs.Seccomp … /tmp/whatever/src/github.com/opencontainers/runtime-tools/validate/validate.go:540: undefined: specs.Syscall $ cd /tmp/whatever/src/github.com/opencontainers/runtime-tools $ git describe --always …
- Get Runtime-Tools dependencies:
These are just build dependencies. We probably want a Makefile rule for them like runtime-spec's install.tools 5.
- Build Runtime-Tools: sudo make install // You have now built the runtime tools! Woo!
With a GOPATH under ~, there's no need for sudo.
- Run the runtime tools against runc: sudo ./test_runtime.sh -r runc -l debug
And once runC gets it's unpriviledged self worked out, there will be no need for sudo here either ;).
On Fri, Dec 02, 2016 at 11:30:07AM -0800, Rob Dolin (MSFT) wrote:
- Check to see if you have git, go, and curl installed:
- git: git --version
- curl: curl --version
You only use cURL to install Go, so I'd leave it out of your dep list (and put it in your “install Go” section, if you keep one instead of linking 1). And on Debian/Ubuntu, the easiest way to install go is with ‘apt-get install golang’ 2.
On Fri, Dec 02, 2016 at 11:55:34AM -0800, W. Trevor King wrote:
And I think it would be more idiomatic to use ~/.local/lib/go for GOPATH.
Scratch that, Go uses ~/work in their docs 1. And mirroring the host directory under ~/.local is probably less important for most folks than not cd'ing into a dotted directory ;). So your GOPATH can stay, but I still think it would be better to set a GOBIN under ~, allowing an unprivileged install.
On Fri, Dec 02, 2016 at 11:30:07AM -0800, Rob Dolin (MSFT) wrote:
// set -o vi
This does not seem necessary ;). Folks who care about their line editing interface will already have opinions, and folks who don't are probably already used to their shell's default.
Here's a Docker session based on the changes I suggested:
$ docker run -it --rm ubuntu:16.10
# apt-get update
# apt-get install git golang go-md2man
# mkdir -p ~/.local/bin
# cat >>~/.profile <<EOF
> export GOPATH=~/work
> export GOBIN=~/.local/bin
> export PATH="${GOBIN}:${PATH}"
> export MANPATH=~/.local/share/man:"${MANPATH}"
> EOF
# source .profile
# go get -d github.com/opencontainers/runtime-tools/cmd/oci-runtime-tool
# cd "${GOPATH}/src/github.com/opencontainers/runtime-tools"
# make
# make install PREFIX=~/.local BINDIR="${GOBIN}"
# command -V oci-runtime-tool
oci-runtime-tool is /root/.local/bin/oci-runtime-tool
# oci-runtime-tool --version
oci-runtime-tool version 0.0.1
BIG THANKS for your thoughtful comments on this @wking.