Docker container dies immediately after starting

Hello everyone,

I am very new to docker on Linux so kindly bear with me. My problem is more compounded, being a newbie to all this.
My OS is Debian (bookworm, amd64) and docker-compose version 1.29.2. Docker version is 20.10.24+dfsg1.

I want to run the Ushahidi platform release as documented at GitHub - ushahidi/platform-release: Releases of the Ushahidi Platform.
My first attempt at simply running docker-compose up fails miserably with the following error, which has been hard to find a solution for:

Attempt #1 -
git clone GitHub - ushahidi/platform-release: Releases of the Ushahidi Platform
cd platform-release
docker-compose up
failure message

Status: Downloaded newer image for ushahidi/php-fpm-nginx:php-7.3
 ---> b4db8dd1519e
Step 2/9 : WORKDIR /var/www
 ---> Running in 72fb1c3db314
Removing intermediate container 72fb1c3db314
 ---> 56cd977ee43b
Step 3/9 : RUN apt-get update && apt-get install -y       unzip       rsync       netcat-openbsd       supervisor       cron       git &&     apt-get clean &&     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Running in b5b21a7b5511
Get:1 http://security.debian.org/debian-security buster/updates InRelease [34.8 kB]
Get:2 http://deb.debian.org/debian buster InRelease [122 kB]
Get:3 http://deb.debian.org/debian buster-updates InRelease [56.6 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 Packages [7909 kB]
Get:6 http://deb.debian.org/debian buster-updates/main amd64 Packages [8788 B]
Get:7 http://security.debian.org/debian-security buster/updates/main amd64 Packages [610 kB]
Get:4 https://packages.sury.org/php buster InRelease
Err:4 https://packages.sury.org/php buster InRelease
  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
Reading package lists...
E: Failed to fetch https://packages.sury.org/php/dists/buster/InRelease  Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: The repository 'https://packages.sury.org/php buster InRelease' is not signed.
The command '/bin/sh -c apt-get update && apt-get install -y       unzip       rsync       netcat-openbsd       supervisor       cron       git &&     apt-get clean &&     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*' returned a non-zero code: 100
ERROR: Service 'ushahidi' failed to build : Build failed
</CUT>

Attempt #2 -
Now I delete the images that have been pulled to save space and opt for different images:

cp Dockerfile.apache Dockerfile
cp docker-compose.apache.yml docker-compose.yml
docker-compose up -d

This runs to almost completion, but …

+ strip --strip-all modules/gd.so
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20180731/
Installing header files:          /usr/local/include/php/
find . -name \*.gcno -o -name \*.gcda | xargs rm -f
find . -name \*.lo -o -name \*.o | xargs rm -f
find . -name \*.la -o -name \*.a | xargs rm -f
find . -name \*.so | xargs rm -f
find . -name .libs -a -type d|xargs rm -rf
rm -f libphp.la      modules/* libs/*
Removing intermediate container 0e6bfbfab309
 ---> 210249256584
Step 3/8 : WORKDIR /var/www
 ---> Running in bd12f73becba
Removing intermediate container bd12f73becba
 ---> 68e038f71596
Step 4/8 : COPY run.sh /run.sh
 ---> 9b1675d5926d
Step 5/8 : COPY build_env.sh /build_env.sh
 ---> 35927f856612
Step 6/8 : COPY dist/ /dist
 ---> d9be09482b6f
Step 7/8 : ENV SERVER_FLAVOR apache2
 ---> Running in d4a52f7711bd
Removing intermediate container d4a52f7711bd
 ---> c4f1b11964b1
Step 8/8 : ENTRYPOINT [ "/bin/bash", "/run.sh" ]
 ---> Running in 3d2b7dd04e92
Removing intermediate container 3d2b7dd04e92
 ---> ee97e31f83b0
Successfully built ee97e31f83b0
Successfully tagged platform-release_ushahidi:latest
**WARNING: Image for service ushahidi was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`.**
Pulling redis (redis:4-alpine)...
4-alpine: Pulling from library/redis
cbdbe7a5bc2a: Pull complete
dc0373118a0d: Pull complete
cfd369fe6256: Pull complete
152ffd6a3b24: Pull complete
7c01860f13a3: Pull complete
aa6ecacd3bee: Pull complete
Digest: sha256:aaf7c123077a5e45ab2328b5ef7e201b5720616efac498d55e65a7afbb96ae20
Status: Downloaded newer image for redis:4-alpine
Creating platform-release_mysql_1 ... done
Creating platform-release_redis_1 ... done
Creating platform-release_ushahidi_1 ... done

Check the status of the new containers…

root@el-diablo:/opt/platform-release# docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED          STATUS          PORTS                 NAMES
c13081c876ad   mysql:5.7        "docker-entrypoint.s…"   34 seconds ago   Up 33 seconds   3306/tcp, 33060/tcp   platform-release_mysql_1
243c214af5d4   redis:4-alpine   "docker-entrypoint.s…"   34 seconds ago   Up 33 seconds   6379/tcp              platform-release_redis_1

So I go ahead and do something about the WARNING above, because the container I need is NOT started:

root@el-diablo:/opt/platform-release# docker-compose build
mysql uses an image, skipping
redis uses an image, skipping
Building ushahidi
Sending build context to Docker daemon  53.25kB
Step 1/8 : FROM php:7.3-apache
 ---> 35da9118b3c0
Step 2/8 : RUN apt-get update && apt-get install -y       libfreetype6-dev       libjpeg62-turbo-dev       libpng-dev       libc-client2007e-dev       libkrb5-dev       libcurl4-openssl-dev       unzip       rsync       netcat-openbsd       supervisor       cron       git &&     docker-php-ext-install curl json mysqli pdo pdo_mysql &&     docker-php-ext-configure imap --with-kerberos --with-imap-ssl &&     docker-php-ext-install imap &&     docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ &&     docker-php-ext-install gd &&     apt-get clean &&     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Using cache
 ---> 210249256584
Step 3/8 : WORKDIR /var/www
 ---> Using cache
 ---> 68e038f71596
Step 4/8 : COPY run.sh /run.sh
 ---> Using cache
 ---> 9b1675d5926d
Step 5/8 : COPY build_env.sh /build_env.sh
 ---> Using cache
 ---> 35927f856612
Step 6/8 : COPY dist/ /dist
 ---> Using cache
 ---> d9be09482b6f
Step 7/8 : ENV SERVER_FLAVOR apache2
 ---> Using cache
 ---> c4f1b11964b1
Step 8/8 : ENTRYPOINT [ "/bin/bash", "/run.sh" ]
 ---> Using cache
 ---> ee97e31f83b0
Successfully built ee97e31f83b0
Successfully tagged platform-release_ushahidi:latest

I check if the container is started, but no, it isn’t:

# docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED         STATUS         PORTS                 NAMES
c13081c876ad   mysql:5.7        "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes   3306/tcp, 33060/tcp   platform-release_mysql_1
243c214af5d4   redis:4-alpine   "docker-entrypoint.s…"   4 minutes ago   Up 4 minutes   6379/tcp              platform-release_redis_1

Next I down all containers"

# docker-compose down
Stopping platform-release_mysql_1 ... done
Stopping platform-release_redis_1 ... done
Removing platform-release_ushahidi_1 ... done
Removing platform-release_mysql_1    ... done
Removing platform-release_redis_1    ... done
Removing network platform-release_default

So I see all the containers going down, much as the others shown did not show up with docker ps.

Next I start all available containers:

root@el-diablo:/opt/platform-release# docker-compose up -d
Creating network "platform-release_default" with the default driver
Creating platform-release_mysql_1 ... done
Creating platform-release_redis_1 ... done
Creating platform-release_ushahidi_1 ... done
root@el-diablo:/opt/platform-release# docker ps # I see three containers started..
CONTAINER ID   IMAGE                       COMMAND                  CREATED          STATUS         PORTS                  NAMES
ae287177ac04   platform-release_ushahidi   "/bin/bash /run.sh r…"   10 seconds ago   Up 9 seconds   0.0.0.0:8080->80/tcp   platform-release_ushahidi_1
eee856ae5259   mysql:5.7                   "docker-entrypoint.s…"   11 seconds ago   Up 9 seconds   3306/tcp, 33060/tcp    platform-release_mysql_1
b13a26651fb5   redis:4-alpine              "docker-entrypoint.s…"   11 seconds ago   Up 9 seconds   6379/tcp               platform-release_redis_1

However, after a few seconds the 1st container dies …

root@el-diablo:/opt/platform-release#docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED          STATUS          PORTS                 NAMES
eee856ae5259   mysql:5.7        "docker-entrypoint.s…"   23 seconds ago   Up 22 seconds   3306/tcp, 33060/tcp   platform-release_mysql_1
b13a26651fb5   redis:4-alpine   "docker-entrypoint.s…"   23 seconds ago   Up 22 seconds   6379/tcp              platform-release_redis_1

Looking at the logs for this container shows me that it did NOT find composer. Is that the reason it’s dying?

How do I add composer so that it finds it?

root@el-diablo:/opt/platform-release# docker logs ae287177ac04
+ export PLATFORM_HOME=/var/www/html
+ PLATFORM_HOME=/var/www/html
+ export PLATFORM_API_HOME=/var/www/html/platform
+ PLATFORM_API_HOME=/var/www/html/platform
++ dirname /run.sh
+ . //build_env.sh
++ client_version=v2024.12.0
++ api_version=v2024.12.1
++ release_version=v6.0.5
++ client_url=
++ api_url=
++ client_tar=platform-client-mzima-v2024.12.0-bin.tar.gz
++ api_tar=ushahidi-platform-bundle-v2024.12.1.tar.gz
+ [[ -z platform-client-mzima-v2024.12.0-bin.tar.gz ]]
+ [[ -z ushahidi-platform-bundle-v2024.12.1.tar.gz ]]
+ '[' -z '' ']'
+ client_url=https://github.com/ushahidi/platform-client-mzima/releases/download/v2024.12.0/platform-client-mzima-v2024.12.0-bin.tar.gz
+ '[' -z '' ']'
+ api_url=https://github.com/ushahidi/platform/releases/download/v2024.12.1/ushahidi-platform-bundle-v2024.12.1.tar.gz
+ release_target_folder=/tmp/release/ushahidi-platform-release-v6.0.5
+ case "$1" in
+ needs_fetch
+ '[' '!' -f /tars/platform-client-mzima-v2024.12.0-bin.tar.gz ']'
+ '[' '!' -f /tars/ushahidi-platform-bundle-v2024.12.1.tar.gz ']'
+ true
+ needs_build
+ '[' '!' -f /tmp/release/ushahidi-platform-release-v6.0.5/.built ']'
+ build
+ mkdir -p /tmp/client
+ tar -C /tmp/client -xz -f /tars/platform-client-mzima-v2024.12.0-bin.tar.gz
+ mkdir -p /tmp/api
+ tar -C /tmp/api -xz -f /tars/ushahidi-platform-bundle-v2024.12.1.tar.gz
+ local client_untar_path=/tmp/client
+ local api_untar_path=/tmp/api/ushahidi-platform-bundle-v2024.12.1
+ mkdir -p /tmp/release/ushahidi-platform-release-v6.0.5
+ mv /tmp/client /tmp/release/ushahidi-platform-release-v6.0.5/html
+ mv /tmp/api/ushahidi-platform-bundle-v2024.12.1 /tmp/release/ushahidi-platform-release-v6.0.5/html/platform
+ cat
+ gen_config_json /tmp/release/ushahidi-platform-release-v6.0.5/html
+ local dir=/tmp/release/ushahidi-platform-release-v6.0.5/html
+ '[' -z '' ']'
+ set +x

!!! MOBILE APP : Incomplete configuration !!!

Please note that for the Ushahidi Mobile App to work with this
deployment, you will need to configure the SITE_URL environment
variable. You should provide the *absolute publicly available*
URL where you are publishing the site, i.e.:

    docker run -e 'SITE_URL=https://site.example.com' ... ushahidi/platform-release:latest

+ sleep 3
+ cat
+ cp /dist/html-htaccess /tmp/release/ushahidi-platform-release-v6.0.5/html/.htaccess
+ cp /dist/platform-htaccess /tmp/release/ushahidi-platform-release-v6.0.5/html/platform/.htaccess
+ cp /dist/platform-httpdocs-htaccess /tmp/release/ushahidi-platform-release-v6.0.5/html/platform/httpdocs/.htaccess
+ mkdir -p /tmp/release/ushahidi-platform-release-v6.0.5/html/platform/storage/app/public
+ cp /dist/platform-storage-app-public-htaccess /tmp/release/ushahidi-platform-release-v6.0.5/html/platform/storage/app/public/.htaccess
+ cp /dist/README.release.md /tmp/release/ushahidi-platform-release-v6.0.5
+ mkdir -p /tmp/release/ushahidi-platform-release-v6.0.5/dist
+ cp /dist/apache-vhost.conf /tmp/release/ushahidi-platform-release-v6.0.5/dist
+ cp /dist/nginx-site.conf /tmp/release/ushahidi-platform-release-v6.0.5/dist
+ chown -R 0:0 /tmp/release/ushahidi-platform-release-v6.0.5
+ find /tmp/release/ushahidi-platform-release-v6.0.5/html -type d -print0
+ xargs -0 chmod 755
+ find /tmp/release/ushahidi-platform-release-v6.0.5/html -type f -print0
+ xargs -0 chmod -w
+ cd /tmp/release/ushahidi-platform-release-v6.0.5/html/platform
+ '[' '!' -d storage ']'
+ chmod -R 0775 storage
+ touch /tmp/release/ushahidi-platform-release-v6.0.5/.built
+ run
+ needs_install
+ '[' '!' -f /var/www/html/.installed ']'
+ install_app
+ rsync -ar /tmp/release/ushahidi-platform-release-v6.0.5/html/ /var/www/html/
+ '[' '!' -f /var/www/html/platform/.env.app_key ']'
+ cat /dev/urandom
+ LC_ALL=C
+ tr -cd 'A-Za-z0-9_\!\@\%\^\&\*\(\)-+='
+ head -1
+ fold -w 32
+ write_platform_env
++ cat /var/www/html/platform/.env.app_key
+ local 'app_key=2XDQ4Sjh2Ezrzv^%Y7UKW=n_&^76sEjP'
+ cat
+ nc -z mysql 3306
+ cd /var/www/html/platform
+ set -x
+ '[' '!' -f storage/passport/oauth-private.key ']'
+ mkdir -p storage/passport
+ php artisan passport:keys
fatal: not a git repository: '/var/www/html/platform/.git'
Encryption keys generated successfully.
+ chmod 770 storage/passport
+ chmod 660 storage/passport/oauth-private.key storage/passport/oauth-public.key
+ composer migrate
**/run.sh: line 249: composer: command not found**

I have spent three days trying to figure this out from Attempt #1.
I hope someone more experienced can easily find a fix for this.

Thank you in advance for your time.

What do you want to achieve? Can you give a high level overview?

I’d like to be able to run the containers. Just that. Whether by using the original Doockerfile or using the *.apache options.

Might you be able to find time to reproduce the failure? Or figure out what I am missing that I need to fix?
To reproduce, the steps are below. The only thing I change is the exposed port to a value !==80 because I have a webserver already taking that.

git clone https://github.com/ushahidi/platform-release.git
cd platform-release/
docker-compose up 

If all your containers are able to run without dying, then I’d love to know what it is I need to do to achieve the same.
Thank you.