Skip to content

Commit

Permalink
Add to the install docs (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwneisen authored May 7, 2024
1 parent a6fa1b4 commit 9287eae
Show file tree
Hide file tree
Showing 5 changed files with 146 additions and 131 deletions.
125 changes: 9 additions & 116 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,139 +42,32 @@ We can be found on the [Kubernetes Slack](https://communityinviter.com/apps/kube

### Install

The easiest way to install `cri-dockerd` is to use one of the pre-built binaries or
packages from the [releases page](https://github.com/Mirantis/cri-dockerd/releases).
There are numerous supported platforms and using a pre-built package will install
the binary and setup your system to run it as a service.

Please refer to your platform's documentation for how to install a package for
additional help with these.
Refer to the [install page](https://mirantis.github.io/cri-dockerd/usage/install/) for instructions on how to install `cri-dockerd` using a package manager.

## Advanced Setup

### Installing manually

> Note: the release packages will install to /usr/bin which is reserved for
> binaries managed by a package manager. Manual installation doesn't involve a
> package manager and thus uses /usr/local/bin and the service file must be edited
> to reflect this.
If you would like to install the project manually, you will need to place the binary
somewhere in your `PATH` and setup a service to run it. The following command is
a manual install for a Linux system using systemd:

```shell
git clone https://github.com/Mirantis/cri-dockerd.git
```

The above step creates a local directory called `cri-dockerd` which you will need for the following steps.

To build this code (in a POSIX environment):

<https://go.dev/doc/install>

```shell
cd cri-dockerd
make cri-dockerd
```

To build for a specific architecture, add `ARCH=` as an argument, where `ARCH` is a known build target for golang

You can find pre-compiled binaries and deb/rpm packages under:

<https://github.com/Mirantis/cri-dockerd/releases>

Where `VERSION` is the latest available cri-dockerd version:

`https://github.com/Mirantis/cri-dockerd/releases/download/v${VERSION}/cri-dockerd-${VERSION}.${ARCH}.tgz`

To install, on a Linux system that uses systemd, and already has Docker Engine installed

```shell
# Run these commands as root

cd cri-dockerd
mkdir -p /usr/local/bin
install -o root -g root -m 0755 cri-dockerd /usr/local/bin/cri-dockerd
install packaging/systemd/* /etc/systemd/system
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
systemctl daemon-reload
systemctl enable --now cri-docker.socket
```
If you want to run `cri-dockerd` on an unsupported platform, instructions can be found on the [manual install page](https://mirantis.github.io/cri-dockerd/usage/manual-install/).

### To use with Kubernetes

The default network plugin for `cri-dockerd` is set to `cni` on Linux. There are
a few ways to change this depending on how you are running the binary.

`--network-plugin=${plugin}` can be passed in as a command line argument when
- running the binary directly
- adding to `/usr/lib/systemd/system/cri-docker.service` if a service isn't enabled
- adding to `/etc/systemd/system/multi-user.target.wants/cri-docker.service` if a service is enabled
If you want to use `cri-dockerd` with Kubernetes, you can find instructions on the [Kubernetes page](https://mirantis.github.io/cri-dockerd/usage/kubernetes/).

Run `systemctl daemon-reload` to restart the service if it was already running.

## Development

### Building

If you would like to build the project yourself, you will need to have Go installed.
You can find directions for installing the latest version on its website:

[Install the latest version of Go](https://golang.org/doc/install)

Once you have Go installed, you can build the project by running the following command:

```shell
make cri-dockerd
```

This will output the binary to the project's root directory as `cri-dockerd`.
You can then run it directly or install it using the manual process above.

To build for a specific architecture, add `ARCH=` as an argument, where `ARCH`
is a known build target for Go.

```shell
ARCH=amd64 make cri-dockerd
```

### Development Setup

When developing, it is nice to have a separate environment to test in so that
you don't have to worry about breaking your system. An easy way to do this is
by setting up a minikube cluster since it uses `cri-dockerd` by default. Follow
the [minikube installation instructions](https://minikube.sigs.k8s.io/docs/start/)
to get it installed.

You'll then be able to create a cluster in minikube's VM by running:

```shell
minikube start
```

Once the cluster is up, we have a `make` command that will build `cri-dockerd`
and swap it out for the version running in the cluster. You can run this command
by running:

```shell
make dev
```
## Developing cri-dockerd

## Docs
We welcome contributions to `cri-dockerd`. If you would like to contribute, please refer to the development section of the [official docs](https://mirantis.github.io/cri-dockerd/development/).

This folder contains the files used to generate the `cri-dockerd` documentation.
## Documentation

The docs are generated using [Hugo](https://gohugo.io/) and the [Geekdocs](https://themes.gohugo.io/hugo-geekdoc/) theme.
The docs are generated using [Hugo](https://gohugo.io/) and the [Geekdocs](https://themes.gohugo.io/hugo-geekdoc/) theme. Hugo will need to be installed to generate the docs found in the `docs/` directory.

### Editing Docs

The docs can be ran locally with hot-reloading to make editing easier. To do so,
run the following command in the project's root directory:
The docs can be ran locally with hot-reloading to make editing easier. To do so, run the following command in the project's root directory:

```bash
make docs
```

This will launch the development server that is included with Hugo. You can then
access the docs at http://localhost:1313/
This will launch the development server that is included with Hugo. You can then access the docs at http://localhost:1313/
4 changes: 3 additions & 1 deletion docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ geekdocNav: false
geekdocAlign: center
---

![docker and kubernetes interact](/images/logo.svg#center)
<p align="center">
<img src="./images/logo.svg" alt="docker and kubernetes interact"/>
</p>

`cri-dockerd` is an adapter that provides a shim for the [Docker Engine](https://docs.docker.com/engine/)
that lets you control Docker via the
Expand Down
26 changes: 20 additions & 6 deletions docs/content/development/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,33 @@
weight: 1
---

If you would like to build the project yourself, you will need to have Go installed.
You can find directions for installing the latest version on its website:
### Prerequisites

[Install the latest version of Go](https://golang.org/doc/install)
If you want to build `cri-dockerd` from source, you will need the following:

Once you have Go installed, you can build the project by running the following command:
- [Install the latest version of Go](https://golang.org/doc/install)

### Building

To build the project yourself, you will need a local copy of the repository. You can clone the repository by running the following command:

```shell
git clone https://github.com/Mirantis/cri-dockerd.git
```

The above step creates a local directory called `cri-dockerd` which you will need for the following steps.

You can build the project by running the following command from within the `cri-dockerd` directory:

```shell
make cri-dockerd
```

This will output the binary to the project's root directory as `cri-dockerd`.
You can then run it directly or install it using the manual process above.
This will output the binary to the project's root directory as `cri-dockerd`. You can then run it directly or install it using [the manual install process](/usage/manual-install/).

> Note: With a local copy of the repo, the service files can be installed from the `packaging/systemd` directory.
### Building for a Specific Architecture

To build for a specific architecture, add `ARCH=` as an argument, where `ARCH`
is a [known build target for Go](https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b8aede63#goarch-values).
Expand Down
51 changes: 47 additions & 4 deletions docs/content/usage/install-manually.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,57 @@
weight: 2
---

If you would like to install the project manually, you will need to place the binary
somewhere in your `PATH` and setup a service to run it. The following commands is
a manual install for a Linux system using systemd:
If you want to run `cri-dockerd` on an unsupported platform, you can manually install the binary and setup the service. This is a more involved process and requires you to manually install the binary and setup the service.
The following instructions are for a Linux system using systemd.

> Note: These commands should be ran as root
> Note: the release packages will install to /usr/bin which is reserved for binaries managed by a package manager. Manual installation doesn't involve a package manager and thus uses /usr/local/bin and the service file must be edited to reflect this.
#### Download

Begin by downloading the latest `.tgz` archive for your platform from the [releases page](https://github.com/Mirantis/cri-dockerd/releases/latest).

Next, extract the archive and change to the extracted directory:

```shell
tar -xzf cri-dockerd-<version>.linux-amd64.tgz
```

#### Install

Install the binary to `/usr/local/bin` by running the following command as root from within the extracted directory:

```shell
install -o root -g root -m 0755 cri-dockerd /usr/local/bin/cri-dockerd
install packaging/systemd/* /etc/systemd/system
```

> Note: the `cp` command cannot be used instead of `install`.
#### Setup the systemd service

Setup the systemd service and socket to start `cri-dockerd`. Download the systemd service and socket files from the `packaging/systemd` directory.

```shell
wget https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.service
wget https://raw.githubusercontent.com/Mirantis/cri-dockerd/master/packaging/systemd/cri-docker.socket
```

```shell
install cri-docker.service /etc/systemd/system
install cri-docker.socket /etc/systemd/system
```

Enable and start the `cri-dockerd` service:

```shell
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
systemctl daemon-reload
systemctl enable --now cri-docker.socket
```

Verify that `cri-dockerd` is installed and running:

```shell
systemctl status cri-docker
```
71 changes: 67 additions & 4 deletions docs/content/usage/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,70 @@
weight: 1
---

The easiest way to install `cri-dockerd` is to use one of the pre-built binaries or
packages from the [releases page](https://github.com/Mirantis/cri-dockerd/releases).
There are numerous supported platforms and using a pre-built package will install
the binary and setup your system to run it as a service.
The easiest way to install `cri-dockerd` is to use one of the pre-built packages from the [releases page](https://github.com/Mirantis/cri-dockerd/releases). There are numerous supported platforms and using a pre-built package will install the binary and setup your system to run it as a service.

Pre-built `.tgz` archives are also available for [manual installation](/usage/manual-install). This is useful if you want to run `cri-dockerd` on an unsupported platform. This is a more involved process and requires you to manually install the binary and setup the service.

### Prerequisites

Before installing `cri-dockerd`, ensure that you have the following prerequisites installed and running on your system:

- [docker](https://docs.docker.com/engine/install/)

### Ubuntu/Debian

`.deb` packages are available for Ubuntu and Debian systems. They make it easy to install `cri-dockerd` using `apt-get` or `dpkg` commands.

Begin by downloading the latest `.deb` package for your distro's version from the [releases page](https://github.com/Mirantis/cri-dockerd/releases/latest).

Next, install the package using your choice of package manager:

```bash
apt-get install ./cri-dockerd-<version>.deb
```

or

```bash
dpkg -i cri-dockerd-<version>.deb
```

Verify that `cri-dockerd` is installed and running:

```bash
systemctl status cri-docker
```

The services should be `active (running)` and `enabled` to start on boot.

### Fedora/CentOS/RHEL

`.rpm` packages are available for Fedora, CentOS, and RHEL systems. They make it easy to install `cri-dockerd` using `dnf` or `yum` commands.

Begin by downloading the latest `.rpm` package for your distro's version from the [releases page](https://github.com/Mirantis/cri-dockerd/releases/latest).

Next, install the package using your choice of package manager:

```bash
dnf install cri-dockerd-<version>.rpm
```

or

```bash
yum install cri-dockerd-<version>.rpm
```

Enable and start the `cri-dockerd` service:

```bash
systemctl enable cri-docker && systemctl start cri-docker
```

Verify that `cri-dockerd` is installed and running:

```bash
systemctl status cri-docker
```

The services should be `active (running)` and `enabled` to start on boot.

0 comments on commit 9287eae

Please sign in to comment.