Container failed to start issue

Every time I try to deploy an application, I run into an issue where the platform gives me the error "Container failed to start" and "Failed to start deployment." without anymore details.
41 Replies
Percy
Percy3mo ago
Project ID: 404566f2-3f4d-4c60-af62-2478a44a8de6
Brody
Brody3mo ago
please provide extra context about what you are trying to deploy and from where
King Kazu
King Kazu3mo ago
sure, trying to deploy hono js api package in my turbo monorepo from github + using dockerfile please let me know if you need any more context
Brody
Brody3mo ago
can you send the dockerfile?
King Kazu
King Kazu3mo ago
# Base stage with node:20-slim and pnpm setup
FROM node:20-slim AS base

# Environment variables for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

# Enable corepack to use pnpm
RUN corepack enable

# Install necessary build tools
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
&& rm -rf /var/lib/apt/lists/*

# Builder stage
FROM base AS builder
WORKDIR /usr/src/app

# Copy root package.json and lockfile
COPY package.json .
COPY pnpm-lock.yaml .

# Copy the rest of the application
COPY . .
RUN pnpm install [email protected] -g
RUN turbo prune @monetize/api --docker

# Install dependencies
RUN pnpm install

# install dependencies in the apps/api folder
RUN pnpm install --prefix ./apps/api

# Expose port 3000
EXPOSE 3000

# Command to run the application
CMD ["node", "./apps/api/dist/server.js"]
# Base stage with node:20-slim and pnpm setup
FROM node:20-slim AS base

# Environment variables for pnpm
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"

# Enable corepack to use pnpm
RUN corepack enable

# Install necessary build tools
RUN apt-get update && apt-get install -y \
build-essential \
python3 \
&& rm -rf /var/lib/apt/lists/*

# Builder stage
FROM base AS builder
WORKDIR /usr/src/app

# Copy root package.json and lockfile
COPY package.json .
COPY pnpm-lock.yaml .

# Copy the rest of the application
COPY . .
RUN pnpm install [email protected] -g
RUN turbo prune @monetize/api --docker

# Install dependencies
RUN pnpm install

# install dependencies in the apps/api folder
RUN pnpm install --prefix ./apps/api

# Expose port 3000
EXPOSE 3000

# Command to run the application
CMD ["node", "./apps/api/dist/server.js"]
Brody
Brody3mo ago
looks alright, can you show the source of the service in the service settings
King Kazu
King Kazu3mo ago
is this what you are looking for?
No description
Brody
Brody3mo ago
yep do you have a volume?
King Kazu
King Kazu3mo ago
no
Brody
Brody3mo ago
how big is the built image?
King Kazu
King Kazu3mo ago
1.434 GB
Brody
Brody3mo ago
does this dockerfile work locally?
King Kazu
King Kazu3mo ago
yeah and sorry the image is like ~2GB actually read wrong thing
Brody
Brody3mo ago
~2gb is kinda big, can you throw in another repo as a test, one that doesn't result in a large image
King Kazu
King Kazu3mo ago
i used another repo of mine and it worked it crashed but it deployed fine so maybe I just need to reduce image size?
Brody
Brody3mo ago
yes please attempt to get it below 1GB
King Kazu
King Kazu3mo ago
ok will try tomorrow and come back with my findings
Brody
Brody3mo ago
sounds good!
King Kazu
King Kazu3mo ago
i got it down to 1.04GB and its still the same error like this is kinda ridiculous there is no error description at all and I literally upgraded from free trial yesterday
Brody
Brody3mo ago
are you able to confirm that this works locally? the Dockerfile that is
King Kazu
King Kazu3mo ago
yeah the image runs fine on my local machine
Brody
Brody3mo ago
can you show me a screenshot of your service?
King Kazu
King Kazu3mo ago
No description
King Kazu
King Kazu3mo ago
not sure exactly what you want me to ss
Brody
Brody3mo ago
is this project id correct?
King Kazu
King Kazu3mo ago
yeah 404566f2-3f4d-4c60-af62-2478a44a8de6 its the same
Brody
Brody3mo ago
how are you getting that project id?
King Kazu
King Kazu3mo ago
cmk k + copy project id
King Kazu
King Kazu3mo ago
No description
King Kazu
King Kazu3mo ago
its the same thing in my project settings
Brody
Brody3mo ago
@Ray - Container failed to start !t
Duchess
Duchess3mo ago
New reply sent from Help Station thread:
This thread has been escalated to the Railway team.
You're seeing this because this thread has been automatically linked to the Help Station thread.
King Kazu
King Kazu3mo ago
ok i just made a new project and it deployed fine wtf
Brody
Brody3mo ago
could you please not touch the original project and service?
King Kazu
King Kazu3mo ago
sure thing ill keep it up 👍
Brody
Brody3mo ago
thanks!
King Kazu
King Kazu3mo ago
it may just get redeployed to, is that fine?
Brody
Brody3mo ago
yeah
Duchess
Duchess3mo ago
New reply sent from Help Station thread:
Could you try switching the runtime in your service settings to "Legacy"?
You're seeing this because this thread has been automatically linked to the Help Station thread.
Ray
Ray3mo ago
^ ignore that, could you try removing the cd step from your start command? It shouldn't be needed should likely just be pnpm start
Want results from more Discord servers?
Add your server