I am currently running docker-compose version 1.18.0, build 8dd22a9
I have an application TEST (Version 1) which is running on a Linux server. When I need to start the application I use “docker-compose up -d” command. I have docker-compose.yml that lists nginx and tomcat(connects to external DB) on port 80:80, 443:443
I want to have another instance of application TEST but Version 2, I want TEST-version1 and TEST-version2 to run simultaneously from the same server on a different port so users can access both. How can I do that with docker-compose ?
Use fixed ports for the production environment and use dynamic ports for the other environment files. Use docker-compose port to find out the dynamic ports.
$ docker-compose port
Print the public port for a port binding.
Usage: port [options] SERVICE PRIVATE_PORT
--protocol=proto tcp or udp [default: tcp]
--index=index index of the container if there are multiple
instances of a service [default: 1]