skip to Main Content

I am running a docker container for a react application.

frontend.Dockerfile

FROM node:14 as builder

RUN mkdir -p /client

WORKDIR /client

COPY package.json /client

RUN npm install

COPY . /client

# copying the crt, key files for https
# COPY ../secret/website_com_au.key ../secret/website_com_au_chain.crt /client

RUN npm run build

FROM nginx

RUN rm /etc/nginx/conf.d/default.conf

COPY nginx.conf /etc/nginx/nginx.conf
COPY --from=builder /client/build /usr/share/nginx/html

EXPOSE 80

RUN chown nginx.nginx /usr/share/nginx/html/ -R

I am building the dockerfile without any error.

sudo docker build -t nabil/website:webclient . -f frontend.Dockerfile

There is also no error after docker run,

sudo docker run -d --net=host nabil/website:webclient

But when I run docker ps or docker container ls, I don’t see the docker container there.

2

Answers


  1. docker ps -a to see all containers even container was dead.

    Check docker logs container_id to see the reason why container was dead.

    Login or Signup to reply.
  2. Check the status of container created:

    docker ps -a (OR)

    docker container ls -a

    Check container logs for failing:

    docker logs <container id/container name> (OR)

    docker container logs <container id/container name>

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search