Minimal images have no ss, ip or tcpdump. You do not have to install them in the container: on the host, nsenter can run your own copies inside the container’s network namespace.
pid=$(docker inspect --format '{{.State.Pid}}' myapp)
sudo nsenter -t "$pid" -n ss -tlnp
sudo nsenter -t "$pid" -n ip addr
-t picks the target process, the container’s main process here, and -n enters only its network namespace. The filesystem stays the host’s, so every tool you have on the host is available, while the network view is the container’s: its interfaces, its IP and the ports it really listens on.
I find this the fastest way to answer whether the app listens on 127.0.0.1 or on all interfaces inside the container, which explains many ports that are published but unreachable. tcpdump -i eth0 works the same way.
It needs root on the host and a Linux host. On Docker Desktop the containers run in a VM, so the PID means nothing to your Mac or Windows shell. There, a debug container with --network container:myapp is the way to go. The PID also changes every time the container restarts, so look it up again rather than reusing an old value.
Further reading: nsenter(1) manual page, docker container inspect