Skip to content

Commit

Permalink
Merge pull request #68 from AkihiroSuda/dev
Browse files Browse the repository at this point in the history
Drop '$' from shell snippets for ease of copy-pasting
  • Loading branch information
AkihiroSuda authored Oct 28, 2024
2 parents 9707904 + 1645412 commit 5016984
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 80 deletions.
8 changes: 4 additions & 4 deletions content/getting-started/common/cgroup2.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ memory pids

To allow delegation of other controllers such as `cpu`, `cpuset`, and `io`, run the following commands:

```console
$ sudo mkdir -p /etc/systemd/system/[email protected]
$ cat <<EOF | sudo tee /etc/systemd/system/[email protected]/delegate.conf
```bash
sudo mkdir -p /etc/systemd/system/[email protected]
cat <<EOF | sudo tee /etc/systemd/system/[email protected]/delegate.conf
[Service]
Delegate=cpu cpuset io memory pids
EOF
$ sudo systemctl daemon-reload
sudo systemctl daemon-reload
```

Delegating `cpuset` is recommended as well as `cpu`. Delegating `cpuset` requires systemd 244 or later.
Expand Down
12 changes: 6 additions & 6 deletions content/getting-started/common/login.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ Use `machinectl shell <user>@` or `ssh <user>@localhost` instead.

To run containers automatically on system start-up, the following command needs to be executed.

```console
$ sudo loginctl enable-linger $(whoami)
```bash
sudo loginctl enable-linger $(whoami)
```

## [Optional] Enable dbus user session
Expand All @@ -53,14 +53,14 @@ active
{{< tabs "sysctl" >}}
{{< tab "apt-get" >}}

```console
$ sudo apt-get install -y dbus-user-session
```bash
sudo apt-get install -y dbus-user-session
```
{{< /tab >}}
{{< tab "dnf" >}}

```console
$ sudo dnf install -y dbus-daemon
```bash
sudo dnf install -y dbus-daemon
```
{{< /tab >}}
{{< /tabs >}}
Expand Down
12 changes: 6 additions & 6 deletions content/getting-started/common/subuid.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ These subuids and subgids are typically automatically configured by the system.

If subuids and subgids are not configured, you need to edit `/etc/subuid` and `/etc/subgid` directly with a text editor:

```console
$ sudo vi /etc/subuid
```bash
sudo vi /etc/subuid
```

Pre-generating all possible values for /etc/subuid and /etc/subgid, based on uid and gid, rather than the user
Expand Down Expand Up @@ -50,14 +50,14 @@ These binaries are typically installed by default.
{{< tabs "uidmap" >}}
{{< tab "apt-get" >}}

```console
$ sudo apt-get install -y uidmap
```bash
sudo apt-get install -y uidmap
```
{{< /tab >}}
{{< tab "dnf" >}}

```console
$ sudo dnf install -y shadow-utils
```bash
sudo dnf install -y shadow-utils
```
{{< /tab >}}
{{< /tabs >}}
Expand Down
16 changes: 8 additions & 8 deletions content/getting-started/common/sysctl.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Create `/etc/sysctl.d/99-rootless.conf` with the following content:
kernel.unprivileged_userns_clone=1
```
Then run the following command to reload the new sysctl configuration:
```console
$ sudo sysctl --system
```bash
sudo sysctl --system
```
{{< /tab >}}
{{< tab "RHEL/CentOS 7">}}
Expand All @@ -58,8 +58,8 @@ user.max_user_namespaces=28633
<!-- nobody knows the origin of the 28633 magic value, lol -->

Then run the following command to reload the new sysctl configuration:
```console
$ sudo sysctl --system
```bash
sudo sysctl --system
```

{{< /tab >}}
Expand All @@ -75,8 +75,8 @@ net.ipv4.ping_group_range = 0 2147483647
```

Then run the following command to reload the new sysctl configuration:
```console
$ sudo sysctl --system
```bash
sudo sysctl --system
```

## Allowing listening on TCP & UDP ports below 1024
Expand All @@ -89,7 +89,7 @@ net.ipv4.ip_unprivileged_port_start=0
```

Then run the following command to reload the new sysctl configuration:
```console
$ sudo sysctl --system
```bash
sudo sysctl --system
```

16 changes: 8 additions & 8 deletions content/getting-started/containerd.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ Created symlink /home/exampleuser/.config/systemd/user/default.target.wants/cont

## Usage

```console
$ nerdctl run hello-world
```bash
nerdctl run hello-world
```

Unlike rootless Docker, you do *NOT* need to specify `$CONTAINERD_ADDRESS` explicitly.
Expand Down Expand Up @@ -108,9 +108,9 @@ Environment="CONTAINERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns"

And then restart the daemon:

```console
$ systemctl --user daemon-reload
$ systemctl --user restart containerd
```bash
systemctl --user daemon-reload
systemctl --user restart containerd
```

### Starting containers on boot
Expand All @@ -120,9 +120,9 @@ You need to run `sudo loginctl enable-linger ...`. See [Getting Started/Login](/
### Resetting to factory settings

Run the following commands to remove all containers and configurations:
```console
$ containerd-rootless-setuptool.sh uninstall
$ rootlesskit rm -rf ~/.local/share/containerd ~/.local/share/nerdctl ~/.config/containerd
```bash
containerd-rootless-setuptool.sh uninstall
rootlesskit rm -rf ~/.local/share/containerd ~/.local/share/nerdctl ~/.config/containerd
```

## Further information
Expand Down
42 changes: 21 additions & 21 deletions content/getting-started/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,25 @@ Especially, make sure [`$XDG_RUNTIME_DIR`](../common/login/) to be set properly.
Docker (since 20.10) provides `docker-ce-rootless-extras` RPMs and DEBs that can be installed by the root for all the users on the host.
The package is usually automatically installed on installing Docker from <https://get.docker.com>.

```console
$ curl -o install.sh -fsSL https://get.docker.com
$ sudo sh install.sh
```bash
curl -o install.sh -fsSL https://get.docker.com
sudo sh install.sh
```

After installing Docker, run the following command as a non-root user to create the systemd user-instance unit:

```console
$ dockerd-rootless-setuptool.sh install
```bash
dockerd-rootless-setuptool.sh install
```

{{< /tab >}}
{{< tab "Without RPMs/DEBs" >}}
This method does not use RPMs/DEBS and can be executed by a non-root user without `sudo`.

```console
$ curl -o rootless-install.sh -fsSL https://get.docker.com/rootless
$ sh rootless-install.sh
$ export PATH=$HOME/bin:$PATH
```bash
curl -o rootless-install.sh -fsSL https://get.docker.com/rootless
sh rootless-install.sh
export PATH=$HOME/bin:$PATH
```
{{< /tab >}}
{{< /tabs >}}
Expand All @@ -61,15 +61,15 @@ To connect to the rootless daemon, you need to set either the CLI context or an

{{< tabs "docker-cli-config" >}}
{{< tab "CLI context (Modern)" >}}
```console
$ docker context use rootless
$ docker run hello-world
```bash
docker context use rootless
docker run hello-world
```
{{< /tab >}}
{{< tab "Env var (Classic)" >}}
```console
$ export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
$ docker run hello-world
```bash
export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock
docker run hello-world
```
{{< /tab >}}
{{< /tabs >}}
Expand Down Expand Up @@ -116,9 +116,9 @@ Environment="DOCKERD_ROOTLESS_ROOTLESSKIT_PORT_DRIVER=slirp4netns"

And then restart the daemon:

```console
$ systemctl --user daemon-reload
$ systemctl --user restart docker
```bash
systemctl --user daemon-reload
systemctl --user restart docker
```

### Starting containers on boot
Expand All @@ -128,9 +128,9 @@ You need to run `sudo loginctl enable-linger ...`. See [Getting Started/Login](/
### Resetting to factory settings

Run the following commands to remove all containers and configurations:
```console
$ dockerd-rootless-setuptool.sh uninstall
$ ~/bin/rootlesskit rm -rf ~/.local/share/docker ~/.config/docker
```bash
dockerd-rootless-setuptool.sh uninstall
~/bin/rootlesskit rm -rf ~/.local/share/docker ~/.config/docker
```

To uninstall binaries, run `sudo apt-get remove docker-ce-*`
Expand Down
33 changes: 17 additions & 16 deletions content/getting-started/kubernetes.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-in-userns
kind supports running Kubernetes inside Rootless Docker/Podman on cgroup v2 hosts.

Docker:
```console
$ dockerd-rootless-setuptool.sh install
$ docker context use rootless
$ kind create cluster
```bash
dockerd-rootless-setuptool.sh install
docker context use rootless
kind create cluster
```

Podman:
```console
$ KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster
```bash
KIND_EXPERIMENTAL_PROVIDER=podman kind create cluster
```

See https://kind.sigs.k8s.io/docs/user/rootless/ for the further information.
Expand All @@ -35,10 +35,10 @@ See https://kind.sigs.k8s.io/docs/user/rootless/ for the further information.

minikube supports running Kubernetes inside Rootless Docker on cgroup v2 hosts.

```console
$ dockerd-rootless-setuptool.sh install
$ docker context use rootless
$ minikube start --driver=docker --container-runtime=containerd
```bash
dockerd-rootless-setuptool.sh install
docker context use rootless
minikube start --driver=docker --container-runtime=containerd
```

See https://minikube.sigs.k8s.io/docs/drivers/docker/ for the further information.
Expand All @@ -49,12 +49,13 @@ See https://minikube.sigs.k8s.io/docs/drivers/docker/ for the further informatio

See https://github.com/rootless-containers/usernetes

```console
$ tar xjvf usernetes-x86_64.tbz
$ cd usernetes
$ ./install.sh --cri=containerd
$ export KUBECONFIG="$HOME/.config/usernetes/master/admin-localhost.kubeconfig"
$ kubectl apply -f manifests/*.yaml
<!-- FIXME: outdated -->
```bash
tar xjvf usernetes-x86_64.tbz
cd usernetes
./install.sh --cri=containerd
export KUBECONFIG="$HOME/.config/usernetes/master/admin-localhost.kubeconfig"
kubectl apply -f manifests/*.yaml
```

## k3s
Expand Down
22 changes: 11 additions & 11 deletions content/getting-started/podman.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ Requires `sudo`.

{{< tabs >}}
{{< tab "apt-get" >}}
```console
$ sudo apt-get install -y podman
```bash
sudo apt-get install -y podman
```
{{< /tab >}}
{{< tab "dnf" >}}

```console
$ sudo dnf install -y podman
```bash
sudo dnf install -y podman
```
{{< /tab >}}
{{< /tabs >}}
Expand All @@ -55,8 +55,8 @@ without `sudo`.

Just run `podman` command.

```console
$ podman run docker.io/library/hello-world
```bash
podman run docker.io/library/hello-world
```

## Tips
Expand Down Expand Up @@ -93,15 +93,15 @@ Also, you need to run `sudo loginctl enable-linger ...`. See [Getting Started/Lo
### Resetting to factory settings

Run the following commands to remove all containers and configurations:
```console
$ podman system reset
```bash
podman system reset
```

The command might not be available with very old podman versions. For old
releases, run the following commands instead:
```console
$ podman rm -f $(podman ps -a -q)
$ podman unshare rm -rf ~/.local/share/containers ~/.config/containers
```bash
podman rm -f $(podman ps -a -q)
podman unshare rm -rf ~/.local/share/containers ~/.config/containers
```

To uninstall binaries, remove `podman` package with the package manager.
Expand Down

0 comments on commit 5016984

Please sign in to comment.