Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Self Hosted Docker container - docker compose exits container with code 0 and stops it #306

Open
4 tasks
nooobcoder opened this issue Jun 27, 2021 · 6 comments

Comments

@nooobcoder
Copy link

I have tried strapi with a postgres db and then too with default sqlite database, none of them worked either on my host machine.
Below are the docker-composes.

COMPOSE STACK WITH POSTGRES DB

version: '3'
services:
  strapi:
    image: strapi/strapi
    environment:
      DATABASE_CLIENT: postgres
      DATABASE_NAME: strapi
      DATABASE_HOST: postgres
      DATABASE_PORT: 5832
      DATABASE_USERNAME: strapi
      DATABASE_PASSWORD: strapi
    volumes:
      - ./app:/srv/app
    ports:
      - '1337:1337'
    depends_on:
      - postgres

  postgres:
    image: postgres
    ports:
      - "5832:5432"
    environment:
      POSTGRES_DB: strapi
      POSTGRES_USER: strapi
      POSTGRES_PASSWORD: strapi
    volumes:
      - ./data:/var/lib/postgresql/data

COMPOSE STACK WITH sqlite DB (default)

version: '3'
services:
  strapi:
    image: strapi/strapi
    volumes:
      - ./app:/srv/app
    ports:
      - '1337:1337'

In either of the cases, the strapi app/admin dashboard server was exiting with status code 1.
I am attaching screenshots for relevance.
Also, FYI, there are no issues with postgres db and i can assure you that.

My Guesses

  • Am i doing something wrong with the file permissions even by setting 777?
  • My postgres default port 5432 is reserved and i need to use 5532 as the port, am i doing something wrong there in the first example of the docker-compose example?
  • Are there still any dependencies issue in the app directory?
  • Is my host machine running out of memory or other resources for which the app is not running and exiting with code zero. To be clear with this, I am attaching a screenshot of htop of my host machine when the compose stack was being run. (I tried the same things on my AWS EC2 instance 7GB RAM DUAL CORE CPU there were no issues and the application ran without hicups btw i used 5432 as postgres port).
Hardware Size/Space/Other
CPU DUAL CORE
RAM 4GB (i guess that's enough)

image
image

I am not jumbling up this thread with screenshots but i can share that in my experiments, this line was the common point of failure for the container to start and i do not why, i had also assigned perms of 777 to the folder and manually ran npm install to install any missing dependencies.

image

strapi_strapi_1 exited with code 0

Also, if you are interested in checking out the contents of the app folder, here is a screenshot of it.

image

Someone please help me out in this case and I am really in a bad mood after allocating hours of work to set strapi up and end with failure.

Thank You,
Ankur Paul (nooobcoder)

@nooobcoder nooobcoder changed the title Self Hosted Docker - docker compose exits container and stops it Self Hosted Docker - docker compose exits container with code 0 and stops it Jun 27, 2021
@nooobcoder nooobcoder changed the title Self Hosted Docker - docker compose exits container with code 0 and stops it Self Hosted Docker container - docker compose exits container with code 0 and stops it Jun 27, 2021
@derrickmehaffy
Copy link
Member

Move issue to correct repo

@derrickmehaffy derrickmehaffy transferred this issue from strapi/strapi Jun 28, 2021
@ChristianHeimke
Copy link

@nooobcoder could you solve this issue or still need support?

@navidJadid
Copy link

navidJadid commented Jan 19, 2022

I have a similar issue and support would be appreciated!

System Details
Ubuntu 18.04 LTS
nodejs 16.13.2
npm 8.1.2

I run a normal docker container with docker run -it -p 1337:1337 -v `pwd`/project-name:/srv/app strapi/strapi as described from the README of the project. I get a similar output:

[...]
Starting your app...
Building your admin UI with development configuration ...

✔ Webpack
  Compiled successfully in 1.65m

navid@navid-Lenovo-G550:~/.../test$ 

The container just terminates after that. I have the same issue when installing via yarn or npx, that it says that it's building the admin UI and then just terminates after 'compiling successfully'. I just don't understand why it would also happen on docker.

Any help would be appreciated~

@dreadedhamish
Copy link

Same issue - Exit code 0
Debian 11, using official v3 container, and also a v4 from @naskio

@navidJadid
Copy link

I switched to another solution overall, but I think I read somewhere that old CPUs might not be supported by all build steps (due to their instruction sets). Mine was 13-14 years old… I don't have the source anymore though, so take it with a grain of salt

@MiqueiasGFernandes
Copy link

MiqueiasGFernandes commented Aug 9, 2023

Same issue here

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants