From 1c81b08c8c0f383fcf8f21b1cd49ac0c9c19bf71 Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Tue, 23 Jun 2015 21:25:49 -0700 Subject: [PATCH] Minor README tweaks to help newbies Signed-off-by: Doug Davis --- README.md | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 12d8d501..e01b810f 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,17 @@ ### Building: ```bash -go get -d github.com/opencontainers/runc -cd $GOPATH/src/github.com/opencontainers/runc/ +# 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 ``` ### Using: -To run a container that you received just execute `runc run` with the JSON format at the argument or have a +To run a container that you received just execute `runc` with the JSON format as the argument or have a `container.json` file in the current working directory. ```bash @@ -27,6 +29,10 @@ PID USER COMMAND ### OCF Container JSON Format: +Below is a sample `container.json` configuration file. It assumes that +the file-system is found in a directory called `rootfs` and there is a +user named `daemon` defined within that file-system. + ```json { "version": "0.1", @@ -126,6 +132,28 @@ PID USER COMMAND ### Examples: +#### Using a Docker image + +To test using Docker's `busybox` image follow these steps: +* Install `docker` and download the `buysbox` image: `docker pull busybox` +* Create a container from that image and export its contents to a tar file: +`docker export $(docker create busybox) > busybox.tar` +* Untar the contents to create your filesystem directory: +``` +mkdir rootfs +tar -C rootfs -xf busybox.tar +``` +* Create a file called `container.json` using the example from above. +Modify the `user` property to be `root`. +* Execute `runc` and you should be placed into a shell where you can run `ps`: +``` +$ runc +/ # ps +PID USER COMMAND + 1 root sh + 9 root ps +``` + #### Using runc with systemd ```service