A secure, lightweight Docker container for pyTMbot - your Telegram-based monitoring and management solution.
amd64
, arm64
orenlab/pytmbot
latest
- Latest stable releaseX.Y.Z
- Specific version releases (e.g., 1.2.3
)alpine-dev
- Development version# 1. Generate authentication salt
docker run --rm orenlab/pytmbot:latest --salt
# 2. Create config directory
mkdir -p /etc/pytmbot
# 3. Download sample config
curl -o /etc/pytmbot/config.yaml \
https://raw.githubusercontent.com/orenlab/pytmbot/master/pytmbot.yaml.sample
# 4. Edit configuration
nano /etc/pytmbot/config.yaml
# 5. Run container
docker run -d \
--name pytmbot \
--restart on-failure \
--env TZ="UTC" \
--volume /etc/pytmbot/config.yaml:/opt/app/pytmbot.yaml:ro \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--security-opt no-new-privileges \
--read-only \
--cap-drop ALL \
--pid host \
--memory 256m \
--cpu-shares 512 \
orenlab/pytmbot:latest --log-level INFO
services:
pytmbot:
image: orenlab/pytmbot:latest
container_name: pytmbot
restart: on-failure
environment:
- TZ=UTC
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /etc/pytmbot/config.yaml:/opt/app/pytmbot.yaml:ro
security_opt:
- no-new-privileges
read_only: true
cap_drop:
- ALL
pid: host
mem_limit: 256m
memswap_limit: 256m
cpu_shares: 512
ulimits:
nproc: 65535
nofile:
soft: 20000
hard: 40000
networks:
- pytmbot_network
tmpfs:
- /tmp:noexec,nosuid,nodev,size=100m
- /var/tmp:noexec,nosuid,nodev,size=50m
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
command: --log-level INFO
networks:
pytmbot_network:
driver: bridge
# If the bot starts without plug-ins, then we disable network interaction:
driver_opts:
com.docker.network.bridge.enable_icc: "false"
# The case when the bot is running with the Monitor plugin enabled:
#driver_opts:
# com.docker.network.bridge.enable_icc: "true"
ipam:
driver: default
config:
- subnet: 172.20.0.0/16
prod_token
or dev_bot_token
depending on modeglobal_chat_id
for notificationsallowed_user_ids
, allowed_admins_ids
, and auth_salt
--webhook True
)--mode prod
for production deploymentsINFO
or ERROR
for production)Standard production deployment:
docker run -d \
--name pytmbot \
--restart on-failure \
--env TZ="UTC" \
--volume /etc/pytmbot/config.yaml:/opt/app/pytmbot.yaml:ro \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--security-opt no-new-privileges \
--read-only \
--cap-drop ALL \
--pid host \
--memory 256m \
--cpu-shares 512 \
orenlab/pytmbot:latest --mode prod --log-level INFO
Webhook mode with reverse proxy:
docker run -d \
--name pytmbot \
--restart on-failure \
--env TZ="UTC" \
--volume /etc/pytmbot/config.yaml:/opt/app/pytmbot.yaml:ro \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
--security-opt no-new-privileges \
--read-only \
--cap-drop ALL \
--pid host \
--memory 256m \
--cpu-shares 512 \
orenlab/pytmbot:latest --mode prod --webhook True --socket_host 0.0.0.0
Argument | Type | Default | Choices | Description |
---|---|---|---|---|
--mode |
str |
prod |
dev , prod |
Select the mode of operation for PyTMBot. Use dev for development and prod for production. |
--log-level |
str |
INFO |
DEBUG , INFO , ERROR |
Set the logging level for the bot. More verbose logs can be helpful during development. |
--webhook |
str |
False |
True , False |
Start the bot in webhook mode. Useful for receiving updates via HTTP callbacks. |
--socket_host |
str |
127.0.0.1 |
N/A | Define the host address for the socket to listen on in webhook mode. Default is localhost. |
--plugins |
list |
[] |
N/A | Specify a comma-separated list of plugins to load. Available: monitor, outline |
--salt |
str |
False |
N/A | Generate unique salt for using it in TOTP authentication |
--health_check |
str |
False |
True , False |
Perform comprehensive health check and exit |
--check-docker |
N/A | N/A | N/A | Check Docker socket access and group configuration, then exit |
pyTMbot supports various plugins to extend functionality:
url
, token
, org
, and bucket
values in configmonitor
sectionapi_url
and cert
paths for Outline API accessEnable specific plugins:
docker run ... orenlab/pytmbot:latest --plugins monitor,outline
Enable single plugin:
docker run ... orenlab/pytmbot:latest --plugins monitor
Development mode with debug logging:
docker run ... orenlab/pytmbot:latest --mode dev --log-level DEBUG --plugins monitor
Webhook mode (requires reverse proxy):
docker run ... orenlab/pytmbot:latest --webhook True --socket_host 0.0.0.0
Container health check:
docker run ... orenlab/pytmbot:latest --health_check
Docker access verification:
docker run ... orenlab/pytmbot:latest --check-docker
The container is configured with the following resource limits for optimal performance:
The container includes built-in health checks that monitor:
# Pull latest version
docker pull orenlab/pytmbot:latest
# Stop current container
docker-compose down
# Start with new version
docker-compose up -d
Each release image is built in an isolated GitHub Actions environment with pinned dependency versions. The build process is fully automated and reproducible. The GitHub Action source code is available in the repository.
docker logs pytmbot
docker exec pytmbot ping -c 1 api.telegram.org
docker stats pytmbot
docker exec pytmbot --check-docker
docker exec pytmbot --health_check
restart: on-failure
instead of unless-stopped
for better resource managementSee our Contributing Guidelines for information on:
Released under the MIT License.