Examples
Table of Contents
- Tutorial
- Local invocation of scripts
- Run scripts inside a local container
- Run scripts remote via SSH
- Install podman to remote Ubuntu 20.04 host
##
Tutorial
In the Git source tree, the TUTORIAL directory inside README.d
contains a hierarchy that persistently enables IP forwarding through sysctl upon the remote SSH host named avocado
First you have to setup SSH public-key authentication for a remote host with hostname avocado
.
Once that is done, you can proceed with the example:
cd TUTORIAL
rr avocado sysctl:apply
###
Steps that rr
performs
rr
performs
- Copies
.files-avocado/
toavocado:/
- Generates the script:
#!/bin/sh
unset IFS
set -efu
PATH=/bin:/sbin:/usr/bin:/usr/sbin
LC_ALL=C
sysctl --system
- Runs the script on host avocado via SSH.
##
Local invocation of scripts
Run locally, the default without a hostname or container PID specified.
Requires tar(1)
for .files
The following are equivalent:
rr namespace:script
rr localhost namespace:script
##
Run scripts inside a local container
NOTE: Linux only
Run on a local container’s PID via nsenter(1)
. Requires tar(1)
for .files
.
rr 1333 namespace:script
##
Run scripts remote via SSH
rr remotehost namespace:script
If a file named .ssh/config
is in the current directory then that is used as the SSH config instead of the default
~/.ssh/config
.
##
Install cri-tools to remote Ubuntu host
$ mkdir -p examples/install-critools
$ cat > examples/install-critools/script <<-'EXAMPLE'
. /etc/os-release
echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | tee /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list
curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | apt-key add -
apt-get update
apt-get -y install cri-tools
EXAMPLE
$ cat .ssh/config
Host remotemost
Hostname 203.0.113.1
User root
$ rr remotehost example:install-critools
...
...