3 months ago
I am getting issue while creating containers
importing to docker
375ms
Build time: 63.66 seconds
=========================
Container failed to start
=========================
The executable cd could not be found
.
5 Replies
3 months ago
Hey there! We've found the following might help you get unblocked faster:
🧵 The executable
/bin/shcould not be found.
If you find the answer from one of these, please let us know by solving the thread!
Railway
Hey there! We've found the following might help you get unblocked faster: - [🧵 The executable 'cd' could not be found.](https://station.railway.com/questions/the-executable-cd-could-not-be-found-2c441b11) - [🧵 Build keeps failing](https://station.railway.com/questions/build-keeps-failing-6647eb88) - [🧵 The executable `/bin/sh` could not be found.](https://station.railway.com/questions/the-executable-bin-sh-could-not-be-fo-964ee881) If you find the answer from one of these, please let us know by solving the thread!
3 months ago
In here
cbarr32
In here
3 months ago
# Multi-stage Dockerfile for MediaVault on Railway
# Stage 1: Build the React frontend
FROM node:18-slim AS frontend-build
WORKDIR /app
# Copy frontend package files
COPY package*.json ./
# Workaround for npm optional dependencies bug
RUN rm -f package-lock.json && \
npm cache clean --force && \
npm install --no-optional && \
npm install @rollup/rollup-linux-x64-gnu --save-optional
# Copy frontend source (exclude backend and node_modules)
COPY src ./src
COPY index.html ./
COPY vite.config.ts ./
COPY tailwind.config.js ./
COPY postcss.config.js ./
COPY tsconfig*.json ./
COPY components.json ./
# Build the frontend
RUN npm run build
# Stage 2: Build the Go backend
FROM golang:1.24-alpine AS backend-build
WORKDIR /app
# Install dependencies
RUN apk add --no-cache git
# Copy backend source
COPY backend/ ./
# Download Go dependencies
RUN go mod download
# Build the backend binary
RUN CGO_ENABLED=0 GOOS=linux go build -o main cmd/server/main.go
# Stage 3: Production image
FROM ubuntu:22.04
WORKDIR /app
# Install ca-certificates for HTTPS requests
RUN apt-get update && \
apt-get install -y ca-certificates tzdata && \
rm -rf /var/lib/apt/lists/*
# Copy the backend binary
COPY --from=backend-build /app/main .
# Copy the frontend build
COPY --from=frontend-build /app/dist ./static
# Make binary executable
RUN chmod +x ./main
# Use Railway's $PORT environment variable
EXPOSE 8080thats my docker file i have removed start but still getting the issue
itsamittomar
# Multi-stage Dockerfile for MediaVault on Railway # Stage 1: Build the React frontend FROM node:18-slim AS frontend-build WORKDIR /app # Copy frontend package files COPY package*.json ./ # Workaround for npm optional dependencies bug RUN rm -f package-lock.json && \ npm cache clean --force && \ npm install --no-optional && \ npm install @rollup/rollup-linux-x64-gnu --save-optional # Copy frontend source (exclude backend and node_modules) COPY src ./src COPY index.html ./ COPY vite.config.ts ./ COPY tailwind.config.js ./ COPY postcss.config.js ./ COPY tsconfig*.json ./ COPY components.json ./ # Build the frontend RUN npm run build # Stage 2: Build the Go backend FROM golang:1.24-alpine AS backend-build WORKDIR /app # Install dependencies RUN apk add --no-cache git # Copy backend source COPY backend/ ./ # Download Go dependencies RUN go mod download # Build the backend binary RUN CGO_ENABLED=0 GOOS=linux go build -o main cmd/server/main.go # Stage 3: Production image FROM ubuntu:22.04 WORKDIR /app # Install ca-certificates for HTTPS requests RUN apt-get update && \ apt-get install -y ca-certificates tzdata && \ rm -rf /var/lib/apt/lists/* # Copy the backend binary COPY --from=backend-build /app/main . # Copy the frontend build COPY --from=frontend-build /app/dist ./static # Make binary executable RUN chmod +x ./main # Use Railway's $PORT environment variable EXPOSE 8080thats my docker file i have removed start but still getting the issue
3 months ago
Could you share your CMD or ENTRYPOINT command that you have on your dockerfile, or the start command that you use on the Railway?
ayush
How to fixAt the end of your Dockerfile, add a CMD or ENTRYPOINT to tell Docker which binary to run when the container starts.Since you’ve built your Go backend into a binary named main, you should run that: # Stage 3: Production imageFROM ubuntu:22.04WORKDIR /app# Install ca-certificates for HTTPS requestsRUN apt-get update && \apt-get install -y ca-certificates tzdata && \rm -rf /var/lib/apt/lists/*# Copy the backend binaryCOPY --from=backend-build /app/main .# Copy the frontend buildCOPY --from=frontend-build /app/dist ./static# Make binary executableRUN chmod +x ./main# Use Railway's $PORT environment variableEXPOSE 8080# Tell Docker what to run when container startsCMD ["./main"]
3 months ago

