Search code examples
dockerubuntudeploymentdocker-composedroplet

How route traffic with docker-compose app on ubuntu?


this is my first time that i try to make a simple deploy, so the procedure is not still clear. This is what i have done: For server i'm using a droplet from Digital Ocean.

  1. I created a simple app in node, make a dockerfile and docker-compose. If i try to lunch "docker-compose up" in local everything is ok.

  2. Then i pushed the project on github

  3. I enstablished a ssh connection with my remote server, and pulled the project form github into the root folder.

  4. I entered in the project folder and lunched "docker-compose up"

The command worked and everything is builed, but if i visit my IP, nothing is showed. So, how can i route the traffic into the container builded?


Solution

  • Well, if your containers are running correctly after docker-compose up command then you should be able to access the services with {IP}:{PORT}. How are the logs?

    By the way, related with that, it is strongly recommended that you start your containers as services by running docker stack deploy {your-stack-name} so they can run in swarm mode, which is the right way to do it in production environment. More on that here