How to access the ubuntu server over the browser / expose docker port

Hi, I m trying to access my dockerize app which is following micro service architecture. In my local machine i can access the app on different ports but in the digital ocean droplet i am unable to acess the app. Here is docker-File and docker-compose file configurations. I have 3 services all service having same dockerfile

# pull official base image
FROM node:13.12.0-alpine

# set working directory

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# install app dependencies
RUN apk add --no-cache git
COPY package.json ./
COPY package-lock.json ./
RUN npm ci

# add app
COPY . ./

# start app
CMD ["npm", "start"]

Here is the main docker-compose file

version: "2.0"
      context: ./host
      - "3000:3000"
    container_name: mfe-host
    stdin_open: true
      context: ./nav
      - "3001:3001"
    container_name: mfe-nav
    stdin_open: true
      context: ./store
      - "3002:3002"
    container_name: mmfe-store
    stdin_open: true

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

This comment has been deleted

    Site Moderator
    Site Moderator badge
    December 4, 2023

    Heya @kainatnazwalrus,

    Make sure you have allowed those ports in your firewall. Whether you are using a firewall on your Droplet like ufw or a DigitalOcean Cloud Firewall, or both, you need to allow the ports your App will use.

    ufw allow PORTHERE

    Hope that helps!

    Try DigitalOcean for free

    Click below to sign up and get $200 of credit to try our products over 60 days!

    Sign up

    Featured on Community

    Get our biweekly newsletter

    Sign up for Infrastructure as a Newsletter.

    Hollie's Hub for Good

    Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

    Become a contributor

    Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

    Welcome to the developer cloud

    DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

    Learn more
    DigitalOcean Cloud Control Panel