Closed larsrickert closed 3 years ago
@philippabele Do you have Windows Subsystem for Linux (WSL2) installed and activated in the docker settings? The docker-compose works fine for me an windows and mac
@larsrickert Yes, I am using WSL with Docker. I updated my system from an outdated Docker V2.5 to the current version. The feature "Use the WSL 2 based engine" is activated. My system config is:
The command docker-compose up -d --build
works and the three container are available. docker ps
provides following
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
6e7511bc79e8 strapi/strapi:latest "docker-entrypoint.s…" 7 minutes ago Up 7 minutes 0.0.0.0:1337->1337/tcp nursing-home-volunteer_strapi_1
166cac7c5a36 postgres "docker-entrypoint.s…" 7 minutes ago Up 7 minutes 5432/tcp nursing-home-volunteer_postgres_1
a198aa0b7774 nursing-home-volunteer/frontend "docker-entrypoint.s…" 7 minutes ago Up 7 minutes 0.0.0.0:3000->3000/tcp nursing-home-volunteer_frontend_1
But the CMS is not accessible on localhost:1337.
docker logs 6e7511bc79e8
provides following information
Starting your app...
Project information
┌────────────────────┬──────────────────────────────────────────────────┐
│ Time │ Fri Oct 29 2021 17:52:22 GMT+0000 (Coordinated … │
│ Launched in │ 17999 ms │
│ Environment │ production │
│ Process PID │ 1 │
│ Version │ 3.6.8 (node v14.16.0) │
│ Edition │ Community │
└────────────────────┴──────────────────────────────────────────────────┘
Actions available
One more thing...
Create your first administrator 💻 by going to the administration panel at:
┌───────────────────────────┐
│ http://0.0.0.0:1337/admin │
└───────────────────────────┘
[2021-10-29T17:52:22.764Z] debug HEAD /admin (8 ms) 200
Error: ENOENT: no such file or directory, open '/srv/app/build/index.html'
[2021-10-29T17:52:22.769Z] info ⏳ Opening the admin panel...
[2021-10-29T17:53:28.171Z] debug GET /admin (4 ms) 200
Error: ENOENT: no such file or directory, open '/srv/app/build/index.html'
[2021-10-29T17:53:28.262Z] debug GET /favicon.ico (9 ms) 200
[2021-10-29T17:53:38.580Z] debug GET /admin (2 ms) 200
Error: ENOENT: no such file or directory, open '/srv/app/build/index.html'
[2021-10-29T17:53:38.625Z] debug GET /favicon.ico (0 ms) 200
I run docker-compose
in cmd.exe , not in wsl.exe.
Running docker-compose
in wsl.exe fix the issue.
What is the reason for this issue? The volume binding in the docker-compose file?
Could you write some notice about this issue in the readme.md to run docker-compose only from wsl.exe NOT cmd.exe ?
@philippabele I found the cause for the issue that strapi throws error "Error: ENOENT: no such file or directory, open '/srv/app/build/FILENAME" when running docker-compose. The docker-compose only specified to run the "strapi start" script. This only starts it but does not build it so the "build" folder does not exist.
I fixed the docker-compose.yml file to build AND start strapi. It now works with cmd.exe and any other terminal. The wsl.exe might just work for you because you somehow build strapi manually. I also removed the docker-compose.override.yml because it allowed to run strapi in dev mode but the frontend and db are always in production mode. So now the docker-compose.yml launches everything in production mode.
@philippabele There are no admin credentials because the database is not committed to git. When you start the backend for the first time and go to localhost:1337/admin you are asked to create an admin account.
There you can choose whatever credentials you want. They will be stored in your local database.
@philippabele I am not able to reproduce your issue. Your local setup may be somehow messed up. Can you delete the docker volume for the database and try a clean start of straps and the db? Then you should be able to create an admin user on localhost:1337/admin.
Added Strapi CMS with postgres db. Use docker-compose to start up strapi, db and frontend.