In order to dockerize the telegram bot, I have to define which port I want to expose. But the telegram docs don't specify what port polling uses. Has anyone successfully dockerized it?
I don't think exposing a port is needed for polling. In polling, telegram bot api only answers to your requests. In webhook, instead, telegram bot api sends you updates, so there you need to expose port 443 (HTTPs).
I run around 6 dockerized bots on node-telegram-bot-api right now. All on polling right now. You don't need to expose anything.
Polling means your script opens a normal http request to Telegram servers and that connection never ends. It has no connection timeout (should have data timeout though, after which it reconnects). Telegram servers just "sleeps" on your connection and when something happens - it just flush that information into opened connection. When you're sending messages to Telegram servers - another http connection opens up, sends the data and closes.
This isn't most performent way to do things, but it's the easiest one, because... you don't have to expose any ports or manage a http server :)
Most helpful comment
I don't think exposing a port is needed for polling. In polling, telegram bot api only answers to your requests. In webhook, instead, telegram bot api sends you updates, so there you need to expose port 443 (HTTPs).