aboutsummaryrefslogtreecommitdiff
path: root/docs/tutorials/remote_client.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/remote_client.md')
-rw-r--r--docs/tutorials/remote_client.md136
1 files changed, 80 insertions, 56 deletions
diff --git a/docs/tutorials/remote_client.md b/docs/tutorials/remote_client.md
index d4c43dda2..ad506d19a 100644
--- a/docs/tutorials/remote_client.md
+++ b/docs/tutorials/remote_client.md
@@ -1,88 +1,112 @@
# Podman remote-client tutorial
-## What is the remote-client
+## Introduction
+The purpose of the Podman remote-client is to allow users to interact with a Podman "backend" while on a separate client. The command line interface of the remote client is exactly the same as the regular Podman commands with the exception of some flags being removed as they do not apply to the remote-client.
-First and foremost, the remote-client is under heavy development. We are adding new
-commands and functions frequently. We also are working on a rootless implementation that
-does not require privileged users.
+The remote client takes advantage of a client-server model. You need Podman installed on a Linux machine or VM that also has the SSH daemon running. On the local operating system, when you execute a Podman command, Podman connects to the server via SSH. It then connects to the Podman service by using systemd socket activation, and hitting our [Rest API](https://docs.podman.io/en/latest/_static/api.html). The Podman commands are executed on the server. From the client's point of view, it seems like Podman runs locally.
-The purpose of the Podman remote-client is to allow users to interact with a Podman "backend"
-while on a separate client. The command line interface of the remote client is exactly the
-same as the regular Podman commands with the exception of some flags being removed as they
-do not apply to the remote-client.
+This tutorial is for running Podman remotely on Linux. If you are using a Mac or a Windows PC, please follow the [Mac and Windows tutorial](https://github.com/containers/podman/blob/master/docs/tutorials/mac_win_client.md)
-## What you need
-To use the remote-client, you will need a binary for your client and a Podman "backend"; hereafter
-referred to as the Podman node. In this context, a Podman node is a Linux system with Podman
-installed on it and the varlink service activated. You will also need to be able to ssh into this
-system as a user with privileges to the varlink socket (more on this later).
+## Obtaining and installing Podman
-## Building the remote client
-At this time, the Podman remote-client is not being packaged for any distribution. It must be built from
-source. To set up your build environment, see [Installation notes](https://github.com/containers/podman/blob/master/install.md) and follow the
-section [Building from scratch](https://github.com/containers/podman/blob/master/install.md#building-from-scratch). Once you can successfully
-build the regular Podman binary, you can now build the remote-client.
+### Client machine
+You will need either Podman or the podman-remote client. The difference between the two is that the compiled podman-remote client can only act as a remote client connecting to a backend, while Podman can run local, standard Podman commands, as well as act as a remote client (using `podman --remote`)
+
+If you already have Podman installed, you do not need to install podman-remote.
+
+You can find out how to [install Podman here](https://podman.io/getting-started/installation)
+
+If you would like to install only the podman-remote client, it is downloadable from its [release description page](https://github.com/containers/podman/releases/latest). You can also build it from source using the `make podman-remote`
+
+
+### Server Machine
+You will need to [install Podman](https://podman.io/getting-started/installation) on your server machine.
+
+
+## Creating the first connection
+
+### Enable the Podman service on the server machine.
+
+Before performing any Podman client commands, you must enable the podman.sock SystemD service on the Linux server. In these examples, we are running Podman as a normal, unprivileged user, also known as a rootless user. By default, the rootless socket listens at `/run/user/${UID}/podman/podman.sock`. You can enable this socket permanently using the following command:
```
-$ make podman-remote
+$ systemctl --user enable podman.socket
```
-Like building the regular Podman, the resulting binary will be in the *bin* directory. This is the binary
-you will run on the remote node later in the instructions.
+You will need to enable linger for this user in order for the socket to work when the user is not logged in:
-## Setting up the remote and Podman nodes
+```
+$ sudo loginctl enable-linger $USER
+```
+This is only required if you are not running Podman as root.
-To use the remote-client, you must perform some setup on both the remote and Podman nodes. In this case,
-the remote node refers to where the remote-client is being run; and the Podman node refers to where
-Podman and its storage reside.
+You can verify that the socket is listening with a simple Podman command.
+```
+$ podman --remote info
+host:
+ arch: amd64
+ buildahVersion: 1.16.0-dev
+ cgroupVersion: v2
+ conmon:
+ package: conmon-2.0.19-1.fc32.x86_64
+```
-### Podman node setup
+#### Enable sshd
-Varlink bridge support is provided by the varlink cli command and installed using:
+In order for the Podman client to communicate with the server you need to enable and start the SSH daemon on your Linux machine, if it is not currently enabled.
```
-$ sudo dnf install varlink-cli
+$ sudo systemctl enable -s sshd
```
-The Podman node must have Podman (not the remote-client) installed as normal. If your system uses systemd,
-then simply start the Podman varlink socket.
+#### Setting up SSH
+Remote Podman uses SSH to communicate between the client and server. The remote client works considerably smoother using SSH keys. To set up your ssh connection, you need to generate an ssh key pair from your client machine.
```
-$ sudo systemctl start io.podman.socket
+$ ssh-keygen
```
+Your public key by default should be in your home directory under ~/.ssh/id_rsa.pub. You then need to copy the contents of id_rsa.pub and append it into ~/.ssh/authorized_keys on the Linux server. You can automate this using ssh-copy-id.
+
+If you do not wish to use SSH keys, you will be prompted with each Podman command for your login password.
+
+## Using the client
+
+Note: `podman-remote` is equivalent to `podman --remote` here, depending on what you have chosen to install.
+
+The first step in using the Podman remote client is to configure a connection.
+
+You can add a connection by using the `podman-remote system connection add` command.
-If your system cannot use systemd, then you can manually establish the varlink socket with the Podman
-command:
```
-$ sudo podman --log-level debug varlink --timeout 0 unix://run/podman/io.podman
+$ podman-remote system connection add myuser --identity ~/.ssh/id_rsa ssh://192.168.122.1/run/user/1000/podman/podman.sock
```
-### Required permissions
-For now, the remote-client requires that you be able to run a privileged Podman and have privileged ssh
-access to the remote system. This limitation is being worked on.
+This will add a remote connection to Podman and if it is the first connection added, it will mark the connection as the default. You can observe your connections with `podman-remote system connection list`:
-### Remote node setup
-
-#### Initiate an ssh session to the Podman node
-To use the remote client, an ssh connection to the Podman server must be established.
+```
+$ podman-remote system connection list
+Name Identity URI
+myuser* id_rsa ssh://myuser@192.168.122.1/run/user/1000/podman/podman.sock
+```
-Using the varlink bridge, an ssh tunnel must be initiated to connect to the server. Podman must then be informed of the location of the sshd server on the targeted server
+Now we can test the connection with `podman info`:
```
-$ export PODMAN_VARLINK_BRIDGE=$'ssh -T -p22 root@remotehost -- "varlink -A \'podman varlink \$VARLINK_ADDRESS\' bridge"'
-$ bin/podman-remote images
-REPOSITORY TAG IMAGE ID CREATED SIZE
-docker.io/library/ubuntu latest 47b19964fb50 2 weeks ago 90.7 MB
-docker.io/library/alpine latest caf27325b298 3 weeks ago 5.8 MB
-quay.io/cevich/gcloud_centos latest 641dad61989a 5 weeks ago 489 MB
-k8s.gcr.io/pause 3.1 da86e6ba6ca1 14 months ago 747 kB
+$ podman-remote info
+host:
+ arch: amd64
+ buildahVersion: 1.16.0-dev
+ cgroupVersion: v2
+ conmon:
+ package: conmon-2.0.19-1.fc32.x86_64
```
-The PODMAN_VARLINK_BRIDGE variable may be added to your log in settings. It does not change per connection.
+Podman-remote has also introduced a “--connection” flag where you can use other connections you have defined. If no connection is provided, the default connection will be used.
-If coming from a Windows machine, the PODMAN_VARLINK_BRIDGE is formatted as:
```
-set PODMAN_VARLINK_BRIDGE=C:\Windows\System32\OpenSSH\ssh.exe -T -p22 root@remotehost -- varlink -A "podman varlink $VARLINK_ADDRESS" bridge
+$ podman-remote system connection --help
```
-The arguments before the `--` are presented to ssh while the arguments after are for the varlink cli. The varlink arguments should be copied verbatim.
- - `-p` is the port on the remote host for the ssh tunnel. `22` is the default.
- - `root` is the currently supported user, while `remotehost` is the name or IP address of the host providing the Podman service.
- - `-i` may be added to select an identity file.
+## Wrap up
+
+You can use the Podman remote clients to manage your containers running on a Linux server. The communication between client and server relies heavily on SSH connections and the use of SSH keys are encouraged. Once you have Podman installed on your remote client, you should set up a connection using `podman-remote system connection add` which will then be used by subsequent Podman commands.
+
+## History
+Adapted from the [Mac and Windows tutorial](https://github.com/containers/podman/blob/master/docs/tutorials/mac_win_client.md)