Update building doc for Docker for Mac users

Signed-off-by: Jess Valarezo <valarezo.jessica@gmail.com>
This commit is contained in:
Jess Valarezo 2017-08-17 10:21:03 -07:00
parent a64399acc2
commit d8abb61bed
2 changed files with 68 additions and 2 deletions

View File

@ -45,6 +45,8 @@ sudo make install
## Via Docker Container ## Via Docker Container
### Build containerd
You can build `containerd` via Docker container. You can build an image from You can build `containerd` via Docker container. You can build an image from
this `Dockerfile`: this `Dockerfile`:
@ -71,3 +73,61 @@ You can move the binaries in your `$PATH` with the command:
```sh ```sh
sudo make install sudo make install
``` ```
### Build runc and containerd
To have complete core container runtime, you will need both `containerd` and `runc`. It is possible to build both of these via Docker container.
You can use `go` to checkout `runc` in your `GOPATH`:
```sh
go get github.com/opencontainers/runc
```
We can build an image from this `Dockerfile`
```sh
FROM golang
RUN apt-get update && \
apt-get install -y btrfs-tools libapparmor-dev libseccomp-dev
```
In our Docker container we will use a specific `runc` build which includes [seccomp](https://en.wikipedia.org/wiki/seccomp) and [apparmor](https://en.wikipedia.org/wiki/AppArmor) support. Hence why our Dockerfile includes these dependencies: `libapparmor-dev` `libseccomp-dev`.
Let's suppose you build an image called `containerd/build` from the above Dockerfile. You can run the following command:
```sh
docker run -it --privileged \
-v /var/lib/containerd \
-v ${GOPATH}/src/github.com/opencontainers/runc:/go/src/github.com/opencontainers/runc \
-v ${GOPATH}/src/github.com/containerd/containerd:/go/src/github.com/containerd/containerd \
-e GOPATH=/go
-w /go/src/github.com/containerd/containerd containerd/build sh
```
This mounts both `runc` and `containerd` repositories in our Docker container.
From within our Docker container let's build `containerd`
```sh
cd /go/src/github.com/containerd/containerd
make && make install
```
These binaries can be found in the `./bin` directory in your host.
`make install` will move the binaries in your `$PATH`.
Next, let's build `runc`
```sh
cd /go/src/github.com/opencontainers/runc
make BUILDTAGS='seccomp apparmor' && make install
```
When working with `ctr`, the containerd CLI we just built, don't forget to start `containerd`!
```sh
containerd --config config.toml
```

10
RUNC.md
View File

@ -1,11 +1,17 @@
containerd is built with OCI support and with support for advanced features provided by `runc`. containerd is built with OCI support and with support for advanced features provided by [runc](https://github.com/opencontainers/runc).
We depend on a specific runc version when dealing with advanced features. You should have a specific build for development. The current supported runc commit is: We depend on a specific `runc` version when dealing with advanced features. You should have a specific runc build for development. The current supported runc commit is:
RUNC_COMMIT = e775f0fba3ea329b8b766451c892c41a3d49594d RUNC_COMMIT = e775f0fba3ea329b8b766451c892c41a3d49594d
For more information on how to clone and build runc see the runc Building [documentation](https://github.com/opencontainers/runc#building).
Note: before building you may need to install additional support, which will vary by platform. For example, you may need to install `libseccomp` and `libapparmor` e.g. `libseccomp-dev` and `libapparmor-dev` for Ubuntu.
## building ## building
From within your `opencontainers/runc` repository run:
### apparmor ### apparmor
```bash ```bash