0
The build folder is ready to be deployed.
You may serve it with a static server:

serve -s build

---> b252a9088991
Removing intermediate container cb5c1e2629c9
Step 16/16 : RUN serve -s build
---> Running in c27b54b31108
serve: Running on port 5000

created and dockerized react application using react-app and getting output like above on "docker-compose up" command but nothing is showing on http://0.0.0.0:5000/ or http://localhost:5000/

version: '3'
services:
web:
   build: .
   image: react-cli
   container_name: react-cli
   volumes:
   - .:/app
   ports:
   - '3000:3000'

above my docker-compose.yml file

FROM scratch
FROM mhart/alpine-node:6.12.0

RUN npm install -g npm --prefix=/usr/local
RUN ln -s -f /usr/local/bin/npm /usr/bin/npm

CMD [ "/bin/sh" ]





ENV NPM_CONFIG_LOGLEVEL warn

RUN npm install -g serve
CMD serve -s build
EXPOSE 3000

COPY package.json package.json
COPY semantic.json semantic.json

COPY npm-shrinkwrap.json npm-shrinkwrap.json
RUN npm install gulp-header --save-dev
RUN npm install --no-optional

COPY . .

RUN npm run build --production

RUN serve -s build

and this is my Dockerfile

1 Answer 1

1

Most likely you are not exposing container port on host. I don't see how your compose file looks, but you probably need to add

ports:
  - "5000:5000"

To your container definition in compose file.

Sign up to request clarification or add additional context in comments.

3 Comments

I just included my docker file and docker compose file
@shijin you are exposing port 3000 in your files, while serve claims that it is serving at 5000. Please change 3000 to 5000 in your files.
I just use 3000 at both files but still serving at 5000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.