https://github.com/xorilog/docker-telegram
Dockerfile for a Telegram gui client
https://github.com/xorilog/docker-telegram
docker docker-telegram telegram
Last synced: 5 months ago
JSON representation
Dockerfile for a Telegram gui client
- Host: GitHub
- URL: https://github.com/xorilog/docker-telegram
- Owner: xorilog
- Created: 2015-04-09T11:39:19.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2024-05-07T08:08:36.000Z (about 2 years ago)
- Last Synced: 2024-05-07T09:28:17.010Z (about 2 years ago)
- Topics: docker, docker-telegram, telegram
- Language: Shell
- Size: 139 KB
- Stars: 63
- Watchers: 7
- Forks: 32
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-telegram
A Docker image that start a fresh telegram client.
[](https://circleci.com/gh/xorilog/docker-telegram)
[](https://microbadger.com/images/xorilog/telegram)
## Usage
To spawn a new instance of Telegram:
### Linux
```shell
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 /.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)
```bash
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 /.TelegramDesktop:/home/user/.local/share/TelegramDesktop/ \
xorilog/telegram
```
## systemd
### Adding the service
```bash
sudo curl -o /etc/systemd/system/telegram@.service "https://raw.githubusercontent.com/xorilog/docker-telegram/master/telegram%40.service"
sudo systemctl daemon-reload
```
### Adding custom parameters
* Add a file: `/etc/systemd/system/telegram@.service.d/proxy.conf` and replace the `` with your parameters
```bash
[Service]
Environment="http_proxy=http://:"
Environment="https_proxy=http://:"
Environment="no_proxy=localhost,.lxd"
Environment=DNS=
```
* reload systemd `sudo systemctl daemon-reload`
* restart your service `sudo systemctl restart telegram@.service`
### Activating for a user
```bash
sudo systemctl enable telegram@.service
sudo systemctl start telegram@.service
```
## Issues
* You have to log out Telegram to close the docker container.
* You have to create your storage directory before start using `mkdir ` as the one created by docker is owned by root user.
## FAQ
### Docker image registry
Images are available in the following registries:
* [Docker](https://hub.docker.com/r/xorilog/telegram): `xorilog/telegram`
* [GitHub Packages](https://github.com/xorilog/docker-telegram/packages/26101): `docker.pkg.github.com/xorilog/docker-telegram/telegram`
* [GitHub Container Registry](https://github.com/users/xorilog/packages/container/package/telegram): `ghcr.io/xorilog/telegram`
### 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
```shell
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](https://github.com/docker/docker/issues/8710).
[This may be more convenient to read](https://gist.github.com/netgusto/931085fc3673b69dd15a1763784307c5)
Thanks to [Telegram](https://telegram.org/) for their great app !