A Docker image that start a fresh telegram client.
To spawn a new instance of Telegram:
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 <Your_storage_dir>/.TelegramDesktop:/home/user/.local/share/TelegramDesktop/ \
xorilog/telegram
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
sudo curl -o /etc/systemd/system/[email protected] "https://raw.githubusercontent.com/xorilog/docker-telegram/master/telegram%40.service"
sudo systemctl daemon-reload
- 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
sudo systemctl enable telegram@<your_username>.service
sudo systemctl start telegram@<your_username>.service
- 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.
Before Docker 1.8 you need to replace --device /dev/snd
by -v /dev/snd:/dev/snd --privileged
.
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 !