Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

floreap's avatar

How to run Laravel application inside Docker?

Hello, folks! I'm struggling with this for days now. I tried different approaches but no success. I get /var/www/vendor does not exist and could not be created: failed to solve: process "/bin/sh -c composer install --no-interaction --no-dev --optimize-autoloader" did not complete successfully: exit code: 1.

docker-compose.yml

Dockerfile

Dockerfile.node

# Set the base image
FROM node:20

# Set working directory
WORKDIR /var/www

# Copy `package.json` and `package-lock.json`
COPY package*.json ./

# Install project dependencies
RUN npm install

# Copy project files into the docker image
COPY . .

# Expose the port Vite runs on
EXPOSE 3000

# Start the Vite server
CMD ["npm", "run", "dev"]
0 likes
3 replies
Sinnbeck's avatar

Is it for production or local dev ?

Please or to participate in this conversation.