Skip to content

Commit 18a4798

Browse files
committed
Update the README and add a dev command
1 parent 814b8d5 commit 18a4798

File tree

3 files changed

+81
-31
lines changed

3 files changed

+81
-31
lines changed

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,7 @@ release: static-linux deb rpm cross-arm cross-mac cross-win ## build the release
9393
cp $(PACKAGING_DIR)/static/build/mac/cri-dockerd-$(VERSION).tgz $(RELEASE_DIR)/cri-dockerd-$(VERSION).darwin.amd64.tgz
9494
# linux
9595
cp $(PACKAGING_DIR)/static/build/linux/cri-dockerd-$(VERSION).tgz $(RELEASE_DIR)/cri-dockerd-$(VERSION).amd64.tgz
96+
97+
.PHONY: dev
98+
dev: cri-dockerd ## Run cri-docker in a running minikube
99+
./scripts/replace-in-minikube

README.md

+68-31
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ For users running `0.2.5` or above, the default network plugin is `cni`. Kuberne
1010
other network plumbing from upstream as part of the `dockershim` removal/deprecation. In order for a cluster to become
1111
operational, Calico, Flannel, Weave, or another CNI should be used.
1212

13-
For CI workflows, basic functionality can be provided via [`containernetworking/plugins`](
14-
https://github.com/containernetworking/plugins).
13+
For CI workflows, basic functionality can be provided via [`containernetworking/plugins`](https://github.com/containernetworking/plugins).
1514

1615
## Motivation
1716

@@ -29,54 +28,92 @@ tool in [Don't Panic: Kubernetes and Docker](https://blog.k8s.io/2020/12/02/dont
2928
and on the Mirantis
3029
[blog](https://www.mirantis.com/blog/mirantis-to-take-over-support-of-kubernetes-dockershim-2/).
3130

32-
## Build and install
31+
## Using cri-dockerd
3332

34-
To begin following the build process for this code, clone this repository in your local environment:
33+
### Install
3534

36-
```shell
37-
git clone https://github.com/Mirantis/cri-dockerd.git
38-
```
39-
40-
The above step creates a local directory called ```cri-dockerd``` which you will need for the following steps.
41-
42-
To build this code (in a POSIX environment):
43-
44-
<https://go.dev/doc/install>
45-
46-
```shell
47-
cd cri-dockerd
48-
make cri-dockerd
49-
```
35+
The easiest way to install `cri-dockerd` is to use one of the pre-built binaries or
36+
packages from the [releases page](https://github.com/Mirantis/cri-dockerd/releases).
37+
There are numerous supported platforms and using a pre-built package will install
38+
the binary and setup your system to run it as a service.
5039

51-
To build for a specific architecture, add `ARCH=` as an argument, where `ARCH` is a known build target for golang
40+
Please refer to your platform's documentation for how to install a package for
41+
additional help with these.
5242

53-
You can find pre-compiled binaries and deb/rpm packages under:
43+
## Advanced Setup
5444

55-
<https://github.com/Mirantis/cri-dockerd/releases>
45+
### Installing manually
5646

57-
Where `VERSION` is the latest available cri-dockerd version:
47+
> Note: the release packages will install to /usr/bin which is reserved for
48+
> binaries managed by a package manager. Manual installation doesn't involve a
49+
> package manager and thus uses /usr/local/bin and the service file must be edited
50+
> to reflect this.
5851
59-
`https://github.com/Mirantis/cri-dockerd/releases/download/v${VERSION}/cri-dockerd-${VERSION}.${ARCH}.tgz`
60-
61-
To install, on a Linux system that uses systemd, and already has Docker Engine installed
52+
If you would like to install the project manually, you will need to place the binary
53+
somewhere in your `PATH` and setup a service to run it. The following command is
54+
a manual install for a Linux system using systemd:
6255

6356
```shell
64-
# Run these commands as root
65-
66-
cd cri-dockerd
67-
mkdir -p /usr/local/bin
6857
install -o root -g root -m 0755 cri-dockerd /usr/local/bin/cri-dockerd
6958
install packaging/systemd/* /etc/systemd/system
7059
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
7160
systemctl daemon-reload
72-
systemctl enable cri-docker.service
7361
systemctl enable --now cri-docker.socket
7462
```
7563

76-
## To use with Kubernetes
64+
### To use with Kubernetes
7765

7866
The default network plugin for `cri-dockerd` is set to `cni` on Linux. To change this, `--network-plugin=${plugin}`
7967
can be passed in as a command line argument if invoked manually, or the systemd unit file
8068
(`/usr/lib/systemd/system/cri-docker.service` if not enabled yet,
8169
or `/etc/systemd/system/multi-user.target.wants/cri-docker.service` as a symlink if it is enabled) should be
8270
edited to add this argument, followed by `systemctl daemon-reload` and restarting the service (if running)
71+
72+
## Development
73+
74+
### Building
75+
76+
If you would like to build the project yourself, you will need to have Go installed.
77+
You can find directions for installing the latest version on its website:
78+
79+
[Install the latest version of Go](https://golang.org/doc/install)
80+
81+
Once you have Go installed, you can build the project by running the following command:
82+
83+
```shell
84+
make cri-dockerd
85+
```
86+
87+
This will output the binary to the project's root directory as `cri-dockerd`.
88+
You can then run it directly or install it using the manual process above.
89+
90+
To build for a specific architecture, add `ARCH=` as an argument, where `ARCH`
91+
is a known build target for Go.
92+
93+
### Development Setup
94+
95+
When developing, it is nice to have a separate environment to test in so that
96+
you don't have to worry about breaking your system. An easy way to do this is
97+
by setting up a minikube cluster since it uses `cri-dockerd` by default. You can
98+
grab the latest version from their repo's releases page:
99+
100+
> You must grab the latest release from their release's page. The version
101+
> installed by their [Getting Started](https://minikube.sigs.k8s.io/docs/start/)
102+
> page is not compatible with the latest version of `cri-dockerd`.
103+
104+
[Install the latest version of minikube](https://github.com/kubernetes/minikube/releases)
105+
106+
You'll then be able to create a cluster in minikube's VM by running:
107+
108+
```shell
109+
minikube start
110+
```
111+
112+
Once the cluster is up, we have a `make` command that will build `cri-dockerd`
113+
and swap it out for the version running in the cluster. You can run this command
114+
by running:
115+
116+
```shell
117+
make dev
118+
```
119+

scripts/replace-in-minikube

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
# This script will swap out the cri-dockerd binary in an already running minikube
4+
5+
minikube cp cri-dockerd /home/docker/cri-dockerd
6+
minikube ssh -- 'sudo chmod +x /home/docker/cri-dockerd'
7+
minikube ssh -- 'sudo systemctl stop cri-docker'
8+
minikube ssh -- 'sudo mv /home/docker/cri-dockerd /usr/bin/cri-dockerd'
9+
minikube ssh -- 'sudo systemctl start cri-docker'

0 commit comments

Comments
 (0)