Skip to content

Commit 13917b0

Browse files
committed
docs: Update command in BUILDING after moving to go modules
Signed-off-by: Shengjing Zhu <[email protected]>
1 parent dc207b6 commit 13917b0

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

BUILDING.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ To build the `containerd` daemon, and the `ctr` simple test client, the followin
2222

2323
First you need to setup your Go development environment. You can follow this
2424
guideline [How to write go code](https://golang.org/doc/code.html) and at the
25-
end you need to have `GOPATH` and `GOROOT` set in your environment.
25+
end you have `go` command in your `PATH`.
2626

27-
At this point you can use `go` to checkout `containerd` in your `GOPATH`:
27+
You need `git` to checkout the source code:
2828

2929
```sh
30-
go get github.com/containerd/containerd
30+
git clone https://github.com/containerd/containerd
3131
```
3232

3333
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,27 +63,23 @@ correct version of `runc` installed.
6363

6464
For the quick and dirty installation, you can use the following:
6565

66-
go get github.com/opencontainers/runc
67-
68-
This is not recommended, as the generated binary will not have version
69-
information. Instead, cd into the source directory and use make to build and
70-
install the binary:
71-
72-
cd $GOPATH/src/github.com/opencontainers/runc
73-
make
74-
make install
66+
```
67+
git clone https://github.com/opencontainers/runc
68+
cd runc
69+
make
70+
sudo make install
71+
```
7572

7673
Make sure to follow the guidelines for versioning in [RUNC.md](RUNC.md) for the
77-
best results. Some pointers on proper build tag setupVersion mismatches can
78-
result in undefined behavior.
74+
best results.
7975

8076
## Build containerd
8177

8278
`containerd` uses `make` to create a repeatable build flow. It means that you
8379
can run:
8480

8581
```
86-
cd $GOPATH/src/github.com/containerd/containerd
82+
cd containerd
8783
make
8884
```
8985

@@ -111,7 +107,10 @@ make generate
111107
> For example, adding `BUILDTAGS=no_btrfs` to your environment before calling the **binaries**
112108
> Makefile target will disable the btrfs driver within the containerd Go build.
113109
114-
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.
110+
Vendoring of external imports uses the [Go Modules](https://golang.org/ref/mod#vendoring). You need
111+
to use `go mod` command to modify the dependencies. After modifition, you should run `go mod tidy`
112+
and `go mod vendor` to ensure the `go.mod`, `go.sum` files and `vendor` directory are up to date.
113+
Changes to these files should become a single commit for a PR which relies on vendored updates.
115114

116115
Please refer to [RUNC.md](/RUNC.md) for the currently supported version of `runc` that is used by containerd.
117116

@@ -131,6 +130,8 @@ make EXTRA_FLAGS="-buildmode pie" \
131130
132131
# Via Docker container
133132

133+
The following instructions assume you are at the parent directory of containerd source directory.
134+
134135
## Build containerd
135136

136137
You can build `containerd` via a Linux-based Docker container.
@@ -148,7 +149,7 @@ containerd source root directory you can run the following command:
148149

149150
```sh
150151
docker run -it \
151-
-v ${PWD}:/go/src/github.com/containerd/containerd \
152+
-v ${PWD}/containerd:/go/src/github.com/containerd/containerd \
152153
-e GOPATH=/go \
153154
-w /go/src/github.com/containerd/containerd containerd/build sh
154155
```
@@ -164,10 +165,10 @@ You are now ready to [build](#build-containerd):
164165
## Build containerd and runc
165166
To have complete core container runtime, you will need both `containerd` and `runc`. It is possible to build both of these via Docker container.
166167

167-
You can use `go` to checkout `runc` in your `GOPATH`:
168+
You can use `git` to checkout `runc`:
168169

169170
```sh
170-
go get github.com/opencontainers/runc
171+
git clone https://github.com/opencontainers/runc
171172
```
172173

173174
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
187188
```sh
188189
docker run -it --privileged \
189190
-v /var/lib/containerd \
190-
-v ${GOPATH}/src/github.com/opencontainers/runc:/go/src/github.com/opencontainers/runc \
191-
-v ${GOPATH}/src/github.com/containerd/containerd:/go/src/github.com/containerd/containerd \
191+
-v ${PWD}/runc:/go/src/github.com/opencontainers/runc \
192+
-v ${PWD}/containerd:/go/src/github.com/containerd/containerd \
192193
-e GOPATH=/go \
193194
-w /go/src/github.com/containerd/containerd containerd/build sh
194195
```

0 commit comments

Comments
 (0)