Docker Community Forums

Share and learn in the Docker community.

Platform_api_1 exited with code 0

Hi, I meet an issue when I run my docker-compose.yml. Here is my .YML

    version: '3.8'
services:
  database:
    image: mongo:4.2
    expose:
      - '27017'
      - '37017'
    environment:
      - MONGO_DATA_DIR=/data/db
      - MONGO_LOG_DIR=/dev/null # TODO : handle logs
    volumes:
      - ./data/mongo:/data/db:rw
    restart: always

  api:
    image: hub.xx.io/xx_demo_api:latest
    depends_on:
      - database
    ports:
      - '3030:3030'
      # - '9229:9229' # this port is for debugger, NOT FOR LIVE
    working_dir: /srv/api
    restart: always
    #    tty: true
    environment:
      VIRTUAL_HOST: api-staging.xx.io
      LETSENCRYPT_HOST: api-staging.xx.io
      LETSENCRYPT_EMAIL: safe@xx.io
      VIRTUAL_PORT: 3030

  frontend:
    image: hub.xx.io/xx_demo_frontend:latest
    ports:
      - '4000:4000'
    restart: 'always'
    stdin_open: true
    tty: true
    environment:
      VIRTUAL_HOST: demo.xx.io
      LETSENCRYPT_HOST: demo.xx.io
      LETSENCRYPT_EMAIL: safe@xx.io
      VIRTUAL_PORT: 4000
      CHOKIDAR_USEPOLLING: 'true'

networks:
  default:
    external:
      name: nginx-proxy

Here is my Dockefile from API

   # Feathers API

FROM  node:12-alpine AS base

RUN mkdir /srv/api && chown node:node /srv/api

WORKDIR /srv/api

USER node

FROM base AS dev
# make global npm packages install under node user
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global

# enable running npm global binaries without path
ENV PATH=$PATH:/home/node/.npm-global/bin 

RUN npm install -g @feathersjs/cli

COPY package*.json ./
RUN npm install --quiet

# using volume instead
# COPY --chown=node:node . .

# LIVE STAGE (does not need volumes)
FROM base AS live

COPY package*.json ./

RUN npm ci --only=production

COPY --chown=node:node . .

ENTRYPOINT ["node", "src/"]

My frontend works perfectly, my DB too. Thank you all in advance.

Hi

What seems to be the issue?

When I run “docker-compose up” or “docker-compose up -d” my api container crash with this error:
“platform_api exited with code 0”.

Maybe the issue is a wrong target in API.

I solved the issue: It was about the wrong image…