You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pataquets 7facec5d51
Dockerfile optimizations: size, speed, readability.
8 months ago
Dockerfile Dockerfile optimizations: size, speed, readability. 8 months ago
README.adoc new features: --devices, --discovery-info, --login-info 8 months ago


This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

= matrix-commander on Docker Hub

If you want to run `matrix-commander` using Docker, there is an official image
available on[Docker Hub]
built from source on each commit and hence easier to run, since only Docker is
required (:clap: to @pataquets for his PR).
The image is based on the latest version of Fedora (35 as of Jun '22).
There is a `linux/amd64` and a `linux/arm64` version available.
Download/update your local image pulling it by doing:

docker pull matrixcommander/matrix-commander

When using Docker, it is recommended to use the `--no-sso` flag because
there is no browser available to perform web-based Single Sign-On.

= matrix-commander with Docker

NOTE: In the following docker commands, the option `:z` is here to make sure that the commands work in systems that use SELinux (eg. Fedora).
For other systems, this options has no influence and can be ignored or removed.

The provided `Dockerfile` builds `matrix-commander` using Fedora 35. If you want to use `Debian`, `Ubuntu` or otherwise, you *must* adjust the `Dockerfile` (e.g. change `dnf` to `apt` and so forth).

== Building the image

From the root folder of the git repository, run:

docker build -t matrix-commander -f docker/Dockerfile .

This will create an image called `matrix-commander`.

Alternatively, you can build the Docker image directly from sources, without cloning the repo:
docker build -t matrix-commander -f docker/Dockerfile

== Using the image

This image requires a folder where `matrix-commander` will store data for credentials and end-to-end encryption.
This folder must be provided to further `run` commands using the `/data` mountpoint.

=== Initialization (only do this once)

Run this command to initialize the `matrix-commander` data folder with new credentials you must answer all the questions that will pop up interactively (homeserver, username, etc.):
docker run --rm -ti -v /my/chosen/folder:/data:z matrix-commander --no-ssl

You can now use this data folder to send messages or verify your session.

=== Send a message to a room

Given an initialized data folder, run this command to send a message to a room:
docker run --rm -v /my/chosen/folder:/data:z matrix-commander -r "<room id>" -m "<some message>"

=== Verify the session

Given an initialized data folder, run this command to start the verification of the matrix-commander session from another existing matrix session:
docker run --rm -ti -v /my/chosen/folder:/data:z matrix-commander --verify

=== How to deal with pipes

When using docker, please understand how docker works with pipes. Read issue 27

This has nothing to do with matrix-commander, but nontheless here are some examples.

In a nutshell:
df -h | docker run --rm -v ./data:/data matrix-commander --code
The above line will *NOT* work. This is not how pipes work in docker.
docker run --rm -ti -v ./data:/data matrix-commander -k -m "$(df -h| head -2)"
The above line works, as there is no pipe into docker.
df -h | head -2 | docker run --rm -i -v ./data:/data matrix-commander --code
The above line works, because -t is *NOT* used.

= matrix-commander with Docker on Raspberry Pi (4b, 32bit, running buster of Raspberry Pi OS)

See Issue #25 for more info:

The libraries
libffi-devel libjpeg-devel zlib-devel
were added to the
dnf install

The command
pip3 install wheel &&
was added to the
pip3 install

See commit