Creating a Dockerfile for signal-cli
provides an isolated environment where you can run the tool without polluting your main system with its dependencies. Here's a basic Dockerfile for this purpose:
# Use an official Java base image. Since signal-cli requires at least JRE 17, we'll use that.
FROM openjdk:17-slim
# Set the version of signal-cli you want to install
ENV SIGNAL_CLI_VERSION=x.y.z
# Download and install signal-cli
RUN apt-get update && \
apt-get install -y wget && \
wget https://github.com/AsamK/signal-cli/releases/download/v"${SIGNAL_CLI_VERSION}"/signal-cli-"${SIGNAL_CLI_VERSION}"-Linux.tar.gz && \
tar xf signal-cli-"${SIGNAL_CLI_VERSION}"-Linux.tar.gz -C /opt && \
ln -sf /opt/signal-cli-"${SIGNAL_CLI_VERSION}"/bin/signal-cli /usr/local/bin/
# Set the entrypoint to signal-cli
ENTRYPOINT ["signal-cli"]
# By default, show the help menu. Users can override this to send/receive messages etc.
CMD ["--help"]
- Replace
x.y.z
in the Dockerfile with the latest version ofsignal-cli
that you want to use. - Save the Dockerfile to a directory.
- Build the Docker image:
docker build -t signal-cli:latest .
- Once built, you can run
signal-cli
using Docker:
docker run --rm signal-cli:latest
If you want to send or receive messages, override the default command:
docker run --rm signal-cli:latest -a +1234567890 send -m "Hello" +0987654321
Note: If you intend to use this regularly, you might want to consider mounting a volume to persist signal-cli
data, especially since cryptographic keys and other data are stored in user's home directory inside the container.
Note 2: This is just a draft code, completely untested, if you find any errors, let me know.