Port binding for containers on local host

I am using -p command along with the ports to bind on local Host, but what if there are many applications and I don’t want to manually assign the port ,any recommendations???

you can use the docker compose -ports in a yml file

ports:
    - "5000:5000"
    volumes:

. Though compose is for muti-containers assembly there is nothing to prevent it for one! Give it a go

Hi,

I am still not clear what you mean by “many applications”. Are you trying to run multiple applications in a single container? It can be done but is not recommended. As far as exposing a port for the application, -p works well for command line. For running multiple applications in multiple containers you can go through ‘Docker Compose’ and add multiple ports in the docker-compose.yml file.
If you are looking for deployment of multiple applications, you can look into ‘Ansible docker_container’ which also enables you to expose multiple ports, as well as, automate your deployment.

Thank you.