Container publish or expose port (-p)

Hi, some container images and docker applications require -p command to set the port of application/container and map it to the host (ros). i know that i can use DST NAT to expose(map) a container to outside, but how could i define the application port number running inside the container.
consider this for example:

docker run -d \
--name mtproxy \
--restart=always \
-e domain="cloudflare.com" \
-e secret="548593a9c0688f4f7d9d57377897d964" \
-e ip_white_list="OFF" \
-p 8080:80 \
-p 8443:443 \
ellermister/mtproxy

if we don’t define the port, the application inside the container may not start listening on any port or it will use a random one(maybe).
thanks for the help
Navid

-p flag in docker maps ports in similar way as dst-nat does in MikroTik. Container should not care about -p parameter, as it’s done on network layer above it.

To add to @antonsb’s answer, dstnat rules allow you to map one port number to another, same as Docker’s -p flag.

Indeed, Docker’s default network is a NAT system, and its -p flag does this same type of dstnat mapping. RouterOS’s container runtime has many differences from Docker’s, but in this case, it’s an exact 1:1 mapping. You don’t need MikroTik to add anything new here.