Coder Social home page Coder Social logo

docker-telegram's Introduction

docker-telegram

A Docker image that start a fresh telegram client.

Circle CI Image Layers

Usage

To spawn a new instance of Telegram:

Linux

docker run --rm -it --name telegram \
       --hostname=$(hostname) \
       -e DISPLAY=unix$DISPLAY \
       -e PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       -v "/home/$(whoami)/.Xauthority:/home/user/.Xauthority" \
       -v $XDG_RUNTIME_DIR/pulse:$XDG_RUNTIME_DIR/pulse \
       -v /etc/localtime:/etc/localtime:ro \
       -v <Your_storage_dir>/.TelegramDesktop:/home/user/.local/share/TelegramDesktop/ \
       xorilog/telegram

Mac Os

Requires xquartz (brew cask install xquartz then reboot your computer & check in preferences>Security : Authenticate & Allow connections checkboxes)

IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
docker run --rm -it --name telegram \
       -e DISPLAY=$(xhost + $(hostname) > /dev/null; echo $IP):0 \
       -v /etc/localtime:/etc/localtime:ro \
       -v <Your_storage_dir>/.TelegramDesktop:/home/user/.local/share/TelegramDesktop/ \
       xorilog/telegram

systemd

Adding the service

sudo curl -o /etc/systemd/system/[email protected] "https://raw.githubusercontent.com/xorilog/docker-telegram/master/telegram%40.service"
sudo systemctl daemon-reload

Adding custom parameters

  • Add a file: /etc/systemd/system/[email protected]/proxy.conf and replace the <value> with your parameters
[Service]
Environment="http_proxy=http://<proxy_name>:<proxy_port>"
Environment="https_proxy=http://<proxy_name>:<proxy_port>"
Environment="no_proxy=localhost,.lxd"
Environment=DNS=<DNS_IP>
  • reload systemd sudo systemctl daemon-reload
  • restart your service sudo systemctl restart telegram@<your_username>.service

Activating for a user

sudo systemctl enable telegram@<your_username>.service
sudo systemctl start telegram@<your_username>.service

Issues

  • You have to log out Telegram to close the docker container.
  • You have to create your storage directory before start using mkdir <Your_storage_dir> as the one created by docker is owned by root user.

FAQ

Docker image registry

Images are available in the following registries:

Docker <1.8

Before Docker 1.8 you need to replace --device /dev/snd by -v /dev/snd:/dev/snd --privileged.

QXcbConnection: Could not connect to display unix:0

This is old but keeping it for older users

xhost +
setenforce 0 (optional, if `xhost +` is not enough: put SELinux in permissive mode)

Do not forget to remove it after start or usage (xhost -, setenforce 1).

The previous command is to be run on a linux machine. But, Mac users I have a special surprise for you. You can also do fun hacks with X11. Details are described here. This may be more convenient to read

Thanks to Telegram for their great app !

docker-telegram's People

Contributors

alexnder avatar alyxazon avatar hellodword avatar nejimiru avatar rdlmda avatar somatorio avatar soulshake avatar xcellardoor avatar xorilog avatar xueyuanl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-telegram's Issues

Container not created ( libgtk-3.so.0: cannot open shared object file: No such file or directory )

ERROR:
"libgtk-3.so.0: cannot open shared object file: No such file or directory"

Container not created. Could you suggest any solution?

exited with the below error in the terminal :

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user'
libgtk-3.so.0: cannot open shared object file: No such file or directory

Telegram Log :

org.telegram.desktop._fe7ffeda496e8935ac5c344c99863f04.desktop
[2023.01.25 16:49:20] QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user'
[2023.01.25 16:49:20] Connecting local socket to /tmp/6ce7de587ddacca886605fc2d7c74451-{87A94AB0-E370-4cde-98D3-ACC110C5967D}...
[2023.01.25 16:49:20] This is the only instance of Telegram, starting server and app...
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAOpenSansRegular.ttf' loaded 'DAOpenSansRegular'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAVazirRegular.ttf' loaded 'DAVazirRegular'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAOpenSansRegularItalic.ttf' loaded 'DAOpenSansRegularItalic'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAVazirRegular.ttf' loaded 'DAVazirRegular'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAOpenSansSemiboldAsBold.ttf' loaded 'DAOpenSansSemibold'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAOpenSansSemiboldItalicAsBold.ttf' loaded 'DAOpenSansSemiboldItalic'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAOpenSansSemiboldAsBold.ttf' loaded 'DAOpenSansSemibold'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAOpenSansSemiboldItalicAsBold.ttf' loaded 'DAOpenSansSemiboldItalic'
[2023.01.25 16:49:21] Font: from ':/gui/fonts/DAVazirMediumAsBold.ttf' loaded 'DAVazirMedium'

NOTE:

OS Info cat /etc/os-release :

PRETTY_NAME="Debian GNU/Linux 10 (buster)"
NAME="Debian GNU/Linux"

Linux kernel version uname -r :

5.10.0-0.bpo.8-amd64

Architecture info uname -m :

x86_64

Already tried :

  • `sudo apt install libgtk-3-0
  • Created/Build an image using FROM debian:buster-slim as downloader successfully. But Facing same issue while creating container

`

Retrieve latest Telegram version during build

Wouldn't it make more sense to retrieve the latest version number of telegram during build, i.e. in the Dockerfile, instead of the update script? I prefer to build the container locally and this would make things much more convenient for me. Maybe I'm missing a good argument against it though?

QThread::start: Thread creation error (Operation not permitted)

Hello.

After starting the docker container, nothing happens.
Inside the docker container, the processes show the running binary and nothing else.

<jemalloc>: arena 0 background thread creation failed (1)
Detected locale "C" with character encoding "UTF-8", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.
QThread::start: Thread creation error (Operation not permitted)

container version: xorilog/telegram:latest

$ dpkg -l | \grep docker | head -1
ii  docker-ce                                        5:20.10.6~3-0~ubuntu-focal                    amd64        Docker: the open-source application container engine
$
$ cat /etc/*release | head -2
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
$

docker run

docker run --rm -it --name telegram \
       --hostname=$(hostname) \
       -e DISPLAY=unix$DISPLAY \
       -e PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       -v "/home/$(whoami)/.Xauthority:/home/user/.Xauthority" \
       -v $XDG_RUNTIME_DIR/pulse:$XDG_RUNTIME_DIR/pulse \
       -v /etc/localtime:/etc/localtime:ro \
       -v /opt/data/:/home/user/.local/share/TelegramDesktop/ \
       xorilog/telegram

libdrm.so.2: cannot open shared object file

https://hub.docker.com/r/xorilog/telegram

docker images|grep xorilog|grep latest
xorilog/telegram       latest              c3b746caa185        28 hours ago        360MB
#!/usr/bin/env bash

docker run --rm -it --name telegram \
       --hostname=$(hostname) \
       --device /dev/snd \
       -e DISPLAY=unix$DISPLAY \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       -v "/home/$(whoami)/.Xauthority:/home/user/.Xauthority" \
       -v /etc/localtime:/etc/localtime:ro \
       -v /opt/teleg/data/:/home/user/.local/share/TelegramDesktop/ \
       xorilog/telegram
./docker-teleg.sh
/usr/bin/Telegram: error while loading shared libraries: libdrm.so.2: cannot open shared object file: No such file or directory

It has a auto download all?

Hello
More than a mistake is a question
I want to configure this on a Linux server. My goal is to configure the client to automatically download all files that have been
Is this possible?
Thank you

File sharing

Im new to docker, could you please give me a hint, how to mount local home folder in rw mode into docker image, so it would actually able to save files and upload. Thank a lot for great receipt!

Do I have to have a monitor? Can VPS be installed?

Detected locale "C" with character encoding "UTF-8", which is not UTF-8.
Qt depends on a UTF-8 locale, and has switched to "C.UTF-8" instead.
If this causes problems, reconfigure your locale. See the locale(1) manual
for more information.
qt.qpa.xcb: could not connect to display unix
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland, wayland-egl, xcb.

libEGL.so.1: cannot open shared object file

I am having this error while installing. Now sure how to fix as I am not very familiar with docker.

โฏ docker run --rm -it --name telegram \
       --hostname=$(hostname) \
       --device /dev/snd \
       -e DISPLAY=unix$DISPLAY \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       -v "/home/$(whoami)/.Xauthority:/home/user/.Xauthority" \
       -v /etc/localtime:/etc/localtime:ro \
       -v ~/docker/volumes/.TelegramDesktop:/home/user/.local/share/TelegramDesktop/ \
       xorilog/telegram
/usr/bin/Telegram: error while loading shared libraries: libEGL.so.1: cannot open shared object file: No such file or directory


screenshot

GUI can not be started on macOS

gui can not be started on macOS Big Sur v11.5.2

output

(Telegram:1): glibmm-WARNING **: Glib::Error::throw_exception():
  unknown error domain 'g-spawn-exit-error-quark': throwing generic Glib::Error exception


(Telegram:1): glibmm-WARNING **: Glib::Error::throw_exception():
  unknown error domain 'g-spawn-exit-error-quark': throwing generic Glib::Error exception


(Telegram:1): glibmm-WARNING **: Glib::Error::throw_exception():
  unknown error domain 'g-spawn-exit-error-quark': throwing generic Glib::Error exception

qt.qpa.xcb: could not connect to display 192.168.31.23:0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, wayland, wayland-egl.

command

IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
docker run --rm -it --name telegram \
       -e DISPLAY=$(xhost + $(hostname) > /dev/null; echo $IP):0 \
       -v /etc/localtime:/etc/localtime:ro \
       -v tg:/home/user/.local/share/TelegramDesktop/ \
       xorilog/telegram

error: XDG_RUNTIME_DIR is invalid or not set in the environment

I am running with command

sudo docker run --rm -it --name telegram \
       --hostname=$(hostname) \
       -e DISPLAY=unix$DISPLAY \
       -e PULSE_SERVER=unix:$XDG_RUNTIME_DIR/pulse/native \
       -e XAUTHORITY=$XAUTHORITY \
       -v $XAUTHORITY:$XAUTHORITY \
       -v /dev/snd:/dev/snd --privileged \
       -v /tmp/.X11-unix:/tmp/.X11-unix \
       -v "/home/$(whoami)/.Xauthority:/home/user/.Xauthority" \
       -v $XDG_RUNTIME_DIR/pulse:$XDG_RUNTIME_DIR/pulse \
       -v /etc/localtime:/etc/localtime:ro \
       -v /.local/share/TelegramDesktop/ \
       xorilog/telegram

and everything works well, except new telegram bots like '@wallet' and other, which are trying to open a new window for their work
then my container crushes with terminal output:

qt.gui.imageio.jpeg: ./lib/jpegli/decode_scan.cc:535: Incomplete scan detected.
qt.gui.imageio.jpeg: ./lib/jpegli/decode_scan.cc:535: Incomplete scan detected.
qt.gui.imageio.jpeg: ./lib/jpegli/decode_scan.cc:535: Incomplete scan detected.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user'
error: XDG_RUNTIME_DIR is invalid or not set in the environment
Fatal: Failed to open server socket: "6ce7de587ddacca886605fc2d7c74451-TelegramDesktop-webview-291-wayland". XDG_RUNTIME_DIR is: ""

or

qt.gui.imageio.jpeg: ./lib/jpegli/decode_scan.cc:535: Incomplete scan detected.
qt.gui.imageio.jpeg: ./lib/jpegli/decode_scan.cc:535: Incomplete scan detected.
qt.gui.imageio.jpeg: ./lib/jpegli/decode_scan.cc:535: Incomplete scan detected.
[libvpx-vp9 @ 0x7f1100ce9400] v1.13.0
[libvpx-vp9 @ 0x7f1100ce9400] v1.13.0
[libvpx-vp9 @ 0x7f1100ce9800] v1.13.0
[libvpx-vp9 @ 0x7f1100ce9800] v1.13.0
qt.gui.imageio.jpeg: ./lib/jpegli/decode_scan.cc:535: Incomplete scan detected.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-user'
error: XDG_RUNTIME_DIR is invalid or not set in the environment
Fatal: Failed to open server socket: "6ce7de587ddacca886605fc2d7c74451-TelegramDesktop-webview-308-wayland". XDG_RUNTIME_DIR is: ""

depending on which bot im launching

Ubuntu 23.04, xorilog/telegram:latest

no sound

Hi, I got it fixed ( no sound when playing voice messages) :

diff --git a/Dockerfile b/Dockerfile
index 42ef77d..b0b1777 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -36,6 +36,7 @@ RUN apt-get update && apt-get install -y \
     software-properties-common \
     libx11-xcb1 \
     gconf2 \
+    libasound2 \
     --no-install-recommends \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.