R
Railway2w ago
Mika

Container event container died

How do i fix this issue? I'm trying to deploy with the docker but it seems to have a issue about container being died everytime
No description
15 Replies
Percy
Percy2w ago
Project ID: 4efcabcd-bcbb-448f-add5-e351605c91d6
Mika
MikaOP2w ago
4efcabcd-bcbb-448f-add5-e351605c91d6
Brody
Brody2w ago
i dont see a project by that id?
Mika
MikaOP2w ago
sorry my bad Project ID: d9c81ecc-be61-45f1-a43c-355a7e7d9042 @Brody , can you see it now?
Brody
Brody2w ago
send your dockerfile please
Mika
MikaOP2w ago
FROM node:18 AS base


WORKDIR /app

COPY package*.json ./

RUN npm install

FROM node:18-slim

WORKDIR /app

COPY --from=base /app .

EXPOSE 8000
FROM node:18 AS base


WORKDIR /app

COPY package*.json ./

RUN npm install

FROM node:18-slim

WORKDIR /app

COPY --from=base /app .

EXPOSE 8000
Brody
Brody2w ago
try this -
FROM node:18

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm ci

COPY . ./

CMD ["node", "src/app.js"]
FROM node:18

WORKDIR /app

COPY package.json package-lock.json ./

RUN npm ci

COPY . ./

CMD ["node", "src/app.js"]
Mika
MikaOP2w ago
same issue this is my composer file
version: '3.8'

services:
backend:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
- /app/node_modules
env_file:
- .env
ports:
- "8000:8000"
depends_on:
- mongodb
version: '3.8'

services:
backend:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
- /app/node_modules
env_file:
- .env
ports:
- "8000:8000"
depends_on:
- mongodb

mongodb:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
command: ["mongod", "--quiet"]

volumes:
mongodb_data:

mongodb:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
command: ["mongod", "--quiet"]

volumes:
mongodb_data:
version: '3.8'

services:
backend:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
- /app/node_modules
env_file:
- .env
ports:
- "8000:8000"
depends_on:
- mongodb
version: '3.8'

services:
backend:
build:
context: .
dockerfile: Dockerfile
volumes:
- .:/app
- /app/node_modules
env_file:
- .env
ports:
- "8000:8000"
depends_on:
- mongodb

mongodb:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
command: ["mongod", "--quiet"]

volumes:
mongodb_data:

mongodb:
image: mongo:latest
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db
command: ["mongod", "--quiet"]

volumes:
mongodb_data:
Brody
Brody2w ago
why have you commented out the CMD line? we also dont support docker compose, you would need to deploy that mongodb yourself from our mongodb option
Mika
MikaOP2w ago
ok thanks
Brody
Brody2w ago
^
Mika
MikaOP2w ago
i have used the command in composer so how can i link the app with mongodb then
Brody
Brody2w ago
please do not commit the .env file to github you need the CMD line in the dockerfile
Mika
MikaOP2w ago
ok thanks
Brody
Brody2w ago
what env variable do you use in code?
Want results from more Discord servers?
Add your server