gbrown
September 16, 2021, 9:46pm
1
I’m trying to run Strapi using the method here
The docker logs show:
Error loading the local develop command. Strapi might not be installed in your “node_modules”. You may need to run “npm install”
Is there a better instruction or fix for this issue ?
How does your dockerfile look?
gbrown
September 17, 2021, 3:50pm
3
version: "3"
services:
strapiexample:
image: strapi/strapi
container_name: strapiexample
restart: unless-stopped
env_file: .env
environment:
DATABASE_CLIENT: ${DATABASE_CLIENT}
DATABASE_NAME: ${DATABASE_NAME}
DATABASE_HOST: ${DATABASE_HOST}
DATABASE_PORT: ${DATABASE_PORT}
DATABASE_USERNAME: ${DATABASE_USERNAME}
DATABASE_PASSWORD: ${DATABASE_PASSWORD}
# links:
# - mongo:mongo
networks:
- strapi-app-network
volumes:
- ./app:/srv/app
ports:
- "1337:1337"
mongoexample:
image: mongo
container_name: mongoexample
restart: unless-stopped
env_file: .env
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
networks:
- strapi-app-network
volumes:
- strapidata:/data/db
ports:
- "27017:27017"
networks:
strapi-app-network:
driver: bridge
volumes:
strapidata:
You can try run
docker-compose up -d && docker strapiexample -f
This should spin up the service and then it will print out what it says. You can also build it again
docker-compose up -d --build
to rebuild it which should then run npm install
in the container.
Third option is to sh into the container and use npm install like
docker container exec -it strapiexample /bin/bash
bin bash might be bin/sh
or bin