docs: Update command in BUILDING after moving to go modules
Signed-off-by: Shengjing Zhu <zhsj@debian.org>
This commit is contained in:
parent
dc207b654d
commit
13917b03dc
41
BUILDING.md
41
BUILDING.md
@ -22,12 +22,12 @@ To build the `containerd` daemon, and the `ctr` simple test client, the followin
|
||||
|
||||
First you need to setup your Go development environment. You can follow this
|
||||
guideline [How to write go code](https://golang.org/doc/code.html) and at the
|
||||
end you need to have `GOPATH` and `GOROOT` set in your environment.
|
||||
end you have `go` command in your `PATH`.
|
||||
|
||||
At this point you can use `go` to checkout `containerd` in your `GOPATH`:
|
||||
You need `git` to checkout the source code:
|
||||
|
||||
```sh
|
||||
go get github.com/containerd/containerd
|
||||
git clone https://github.com/containerd/containerd
|
||||
```
|
||||
|
||||
For proper results, install the `protoc` release into `/usr/local` on your build system. For example, the following commands will download and install the 3.11.4 release for a 64-bit Linux host:
|
||||
@ -63,19 +63,15 @@ correct version of `runc` installed.
|
||||
|
||||
For the quick and dirty installation, you can use the following:
|
||||
|
||||
go get github.com/opencontainers/runc
|
||||
|
||||
This is not recommended, as the generated binary will not have version
|
||||
information. Instead, cd into the source directory and use make to build and
|
||||
install the binary:
|
||||
|
||||
cd $GOPATH/src/github.com/opencontainers/runc
|
||||
```
|
||||
git clone https://github.com/opencontainers/runc
|
||||
cd runc
|
||||
make
|
||||
make install
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Make sure to follow the guidelines for versioning in [RUNC.md](RUNC.md) for the
|
||||
best results. Some pointers on proper build tag setupVersion mismatches can
|
||||
result in undefined behavior.
|
||||
best results.
|
||||
|
||||
## Build containerd
|
||||
|
||||
@ -83,7 +79,7 @@ result in undefined behavior.
|
||||
can run:
|
||||
|
||||
```
|
||||
cd $GOPATH/src/github.com/containerd/containerd
|
||||
cd containerd
|
||||
make
|
||||
```
|
||||
|
||||
@ -111,7 +107,10 @@ make generate
|
||||
> For example, adding `BUILDTAGS=no_btrfs` to your environment before calling the **binaries**
|
||||
> Makefile target will disable the btrfs driver within the containerd Go build.
|
||||
|
||||
Vendoring of external imports uses the [`vndr` tool](https://github.com/LK4D4/vndr) which uses a simple config file, `vendor.conf`, to provide the URL and version or hash details for each vendored import. After modifying `vendor.conf` run the `vndr` tool to update the `vendor/` directory contents. Combining the `vendor.conf` update with the changeset in `vendor/` after running `vndr` should become a single commit for a PR which relies on vendored updates.
|
||||
Vendoring of external imports uses the [Go Modules](https://golang.org/ref/mod#vendoring). You need
|
||||
to use `go mod` command to modify the dependencies. After modifition, you should run `go mod tidy`
|
||||
and `go mod vendor` to ensure the `go.mod`, `go.sum` files and `vendor` directory are up to date.
|
||||
Changes to these files should become a single commit for a PR which relies on vendored updates.
|
||||
|
||||
Please refer to [RUNC.md](/RUNC.md) for the currently supported version of `runc` that is used by containerd.
|
||||
|
||||
@ -131,6 +130,8 @@ make EXTRA_FLAGS="-buildmode pie" \
|
||||
|
||||
# Via Docker container
|
||||
|
||||
The following instructions assume you are at the parent directory of containerd source directory.
|
||||
|
||||
## Build containerd
|
||||
|
||||
You can build `containerd` via a Linux-based Docker container.
|
||||
@ -148,7 +149,7 @@ containerd source root directory you can run the following command:
|
||||
|
||||
```sh
|
||||
docker run -it \
|
||||
-v ${PWD}:/go/src/github.com/containerd/containerd \
|
||||
-v ${PWD}/containerd:/go/src/github.com/containerd/containerd \
|
||||
-e GOPATH=/go \
|
||||
-w /go/src/github.com/containerd/containerd containerd/build sh
|
||||
```
|
||||
@ -164,10 +165,10 @@ You are now ready to [build](#build-containerd):
|
||||
## Build containerd and runc
|
||||
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`:
|
||||
You can use `git` to checkout `runc`:
|
||||
|
||||
```sh
|
||||
go get github.com/opencontainers/runc
|
||||
git clone https://github.com/opencontainers/runc
|
||||
```
|
||||
|
||||
We can build an image from this `Dockerfile`:
|
||||
@ -187,8 +188,8 @@ Let's suppose you build an image called `containerd/build` from the above Docker
|
||||
```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 \
|
||||
-v ${PWD}/runc:/go/src/github.com/opencontainers/runc \
|
||||
-v ${PWD}/containerd:/go/src/github.com/containerd/containerd \
|
||||
-e GOPATH=/go \
|
||||
-w /go/src/github.com/containerd/containerd containerd/build sh
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user