Installation with Docker doesn't work
To reproduce the issue just follow "Installation with Docker" section of README.md.
What is the expected result?
Get app installed and set up
What do you get instead?
Error:
$ git clone https://github.com/np25071984/app.git
Cloning into 'app'...
remote: Enumerating objects: 2383, done.
remote: Counting objects: 100% (864/864), done.
remote: Compressing objects: 100% (343/343), done.
remote: Total 2383 (delta 592), reused 674 (delta 500), pack-reused 1519 (from 1)
Receiving objects: 100% (2383/2383), 633.44 KiB | 2.21 MiB/s, done.
Resolving deltas: 100% (1347/1347), done.
$ cd app/
$ make composer update
[+] Building 1.2s (7/9) docker:desktop-linux
=> [app internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.51kB 0.0s
=> [app internal] load metadata for ghcr.io/shyim/wolfi-php/frankenphp:8.3 1.0s
=> [app internal] load metadata for docker.io/composer/composer:latest-bin 0.7s
=> [app internal] load .dockerignore 0.0s
=> => transferring context: 175B 0.0s
=> CACHED [app base 1/2] FROM ghcr.io/shyim/wolfi-php/frankenphp:8.3@sha256:6dc27a62141eccc6dae6b568cf61b4660998d7e535367e314 0.0s
=> CACHED [app composer 1/1] FROM docker.io/composer/composer:latest-bin@sha256:33f6a46e1997c2ad441d4b7940e9a8e78d1b4b160510b 0.0s
=> ERROR [app base 2/2] RUN <<SH (set -eo pipefail...) 0.1s
------
> [app base 2/2] RUN <<SH (set -eo pipefail...):
0.091 + addgroup -g 1697215263 -S www-data
0.092 addgroup: number 1697215263 is not in 0..256000 range
------
failed to solve: process "/bin/sh -c set -eo pipefail\n set -x\n\n # Add www-data group and user.\n addgroup -g ${GID} -S www-data\n adduser -u ${UID} -D -S -G www-data www-data\n\n # Set volume permissions.\n mkdir -p /data /config /app/runtime && \\\n chown -R www-data:www-data /data /config /app/runtime\n\n # Install extra packages.\n apk add --no-cache \\\n php-frankenphp-8.3-opcache \\\n php-frankenphp-8.3-mbstring \\\n php-frankenphp-8.3-intl \\\n php-frankenphp-8.3-dom \\\n php-frankenphp-8.3-curl \\\n php-frankenphp-8.3-phar \\\n php-frankenphp-8.3-openssl \\\n php-frankenphp-8.3-xml \\\n php-frankenphp-8.3-xmlwriter \\\n php-frankenphp-8.3-simplexml \\\n php-frankenphp-8.3-pdo\n" did not complete successfully: exit code: 1
make: *** [run] Error 17
Additional info
| Q | A |
|---|---|
| Version | master |
| PHP version | none |
| Operating system | MacOS 15.2 |
What do you have if you run id in a local console?
$ id
uid=818890062(XXX) gid=1697215263 ...
What Mac do you have?
Also send please whereis brew result
$ whereis brew
brew: /opt/homebrew/bin/brew /opt/homebrew/share/man/man1/brew.1
I think it's better to create a new user and run docker there
Please comment out these environment variables in docker/compose.dev.yml
https://github.com/yiisoft/app/blob/7e3746ae652402bc5e071550f821b3496daacc35/docker/compose.dev.yml#L7-L9
Please comment out these environment variables in
app/docker/compose.dev.ymlhttps://github.com/yiisoft/app/blob/7e3746ae652402bc5e071550f821b3496daacc35/docker/compose.dev.yml#L7-L9
That got me little further in the process
=> [app] exporting to image 0.1s
=> => exporting layers 0.1s
=> => writing image sha256:70fb958ba1e5ca20f436cea5525da9b5560999eeabd240f644829aa3d2e493d1 0.0s
=> => naming to docker.io/library/app-app 0.0s
=> [app] resolving provenance for metadata file 0.0s
Loading composer repositories with package information
Updating dependencies
Lock file operations: 190 installs, 0 updates, 0 removals
- Locking alexkart/curl-builder (1.0.8)
- Locking amphp/amp (v2.6.4)
- Locking amphp/byte-stream (v1.8.2)
...
- Locking yiisoft/yii-view-renderer (7.2.0)
- Locking zircote/swagger-php (4.11.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 190 installs, 0 updates, 0 removals
- Downloading codeception/c3 (2.9.0)
- Downloading infection/extension-installer (0.1.2)
- Downloading yiisoft/strings (2.4.0)
- Downloading yiisoft/arrays (3.1.0)
...
- Installing yiisoft/arrays (3.1.0): Extracting archive
- Installing yiisoft/var-dumper (1.7.0): Extracting archive
0/3 [>---------------------------] 0% Install of yiisoft/arrays failed
3/3 [============================] 100%
In RecursiveDirectoryIterator.php line 48:
RecursiveDirectoryIterator::__construct(/app/vendor/yiisoft/arrays): Failed to open directory: No such file or directory
update [--with WITH] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--dry-run] [--dev] [--no-dev] [--lock] [--no-install] [--no-audit] [--audit-format AUDIT-FORMAT] [--no-autoloader] [--no-suggest] [--no-progress] [-w|--with-dependencies] [-W|--with-all-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [-m|--minimal-changes] [--patch-only] [-i|--interactive] [--root-reqs] [--bump-after-update [BUMP-AFTER-UPDATE]] [--] [<packages>...]
make: *** [run] Error 1
Run composer diagnose to check for common problems:
composer diagnose --profile
Or try clearing the cache and updating the composer version:
composer clear-cache
composer self-update --stable
composer self-update --stable
Helped. I am surprised it uses my host system composer while deploying things in docker container...
Also my host 80 port has already been occupied by another app. How to set alternative port number?
Also my host 80 port has already been occupied by another app. How to set alternative port number?
Modify the DEV_PORT environment variable in docker/.env:
https://github.com/yiisoft/app/blob/7e3746ae652402bc5e071550f821b3496daacc35/docker/.env#L9
Then restart the docker container:
make down
make up
Now I got this
Having similar issue with docker on my mac
=> ERROR [app base 2/2] RUN <<SH (set -eo pipefail...) 0.3s
------
> [app base 2/2] RUN <<SH (set -eo pipefail...):
0.268 + addgroup -g 20 -S www-data
0.270 addgroup: gid '20' in use
------
failed to solve: process "/bin/sh -c set -eo pipefail\n set -x\n\n # Add www-data group and user...." did not complete successfully: exit code: 1
make: *** [up] Error 1
$ id -g
20
Changing UID/GID in Makefile solved the problem for me but im not sure its good solution
export UID=1000
export GID=1000
It is OK. The problem is Mac-specific. I'll solve it a bit later.
=> ERROR [app dev 3/3] RUN groupadd --gid 20 appuser; useradd --gid 20 --uid 501 appuser; setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; chown - 0.2s
------
> [app dev 3/3] RUN groupadd --gid 20 appuser; useradd --gid 20 --uid 501 appuser; setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; chown -R appuser:appuser /data/caddy && chown -R appuser:appuser /config/caddy:
0.133 groupadd: GID '20' already exists
0.138 useradd warning: appuser's uid 501 outside of the UID_MIN 1000 and UID_MAX 60000 range.
0.202 chown: invalid group: 'appuser:appuser'
------
failed to solve: process "/bin/sh -c groupadd --gid ${GROUP_ID} ${GROUP_NAME}; useradd --gid ${GROUP_ID} --uid ${USER_ID} ${GROUP_NAME}; \tsetcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/frankenphp; \tchown -R ${USER_NAME}:${GROUP_NAME} /data/caddy && chown -R ${USER_NAME}:${GROUP_NAME} /config/caddy" did not complete successfully: exit code: 1
make: *** [up] Error 1
UID = 501 is my current user. GID = 20 is "staff" default group.