Report this

What is the reason for this report?

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

Posted on December 4, 2023

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
WORKDIR /app

# 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"
services:
  mfe-host:
    build:
      context: ./host
    ports:
      - "3000:3000"
    container_name: mfe-host
    stdin_open: true
  mfe-nav:
    build:
      context: ./nav
    ports:
      - "3001:3001"
    container_name: mfe-nav
    stdin_open: true
  mfe-store:
    build:
      context: ./store
    ports:
      - "3002:3002"
    container_name: mmfe-store
    stdin_open: true


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!

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.

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!

This comment has been deleted

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.