Closed Sandra790 closed 1 year ago
I was not able to repro this problem, as you can see this line should have copied the container/entrypoint.sh
to /entrypoint
:
https://github.com/naveed125/docker-lumen-app/blob/main/Dockerfile#L48
Can you try running the following commands:
docker compose down
docker compose up -d --force-recreate
I've run the listed commands but problem exists anymore. Some details to my system:
I tested the file with an other path. I moved it to the directory where the Dockerfile is. Of course I edited the path for the entrypoint.sh in Dockerfile but same problem. Redis and mysql container are running.
I was able to repro the issue on windows. The issue was that vendor directory was missing due to the docker-compose volume directive. My fix should resolve the issue. Let me know if it doesn't. Thanks for reporting it.
It doesn't work for me :-(
What I've done:
And then I get the error
Error response from daemon: Container 3934b8adab8a26c6a2c46603d6be3bafd6fa0fcab2c85fe70fdd65eb0707b593 is restarting, wait until the container is running
Can you try docker compose build before step 4?
Nope same error.
Error response from daemon: Container 7eb25e16fc795cf054041f02edf3b30aeff66b737d0756c2e451c4980595a16e is restarting, wait until the container is running
Docker Desktop Log shows the error exec /entrypoint.sh: no such file or directory
.
This is some kind of weird docker caching issue and I was able to reproduce it! To fix it, I made a small unimpactful change to entrypoint.sh script and then it worked. Here is my full log:
C:\Users\navee\projects>git clone https://github.com/naveed125/docker-lumen-app.git
Cloning into 'docker-lumen-app'...
remote: Enumerating objects: 146, done.
remote: Counting objects: 100% (146/146), done.
Receiving objects: 100% (146/146), 49.90 KiB | 4.54 MiB/s, done.
remote: Compressing objects: 80% (86/107)
remote: Compressing objects: 100% (107/107), done.
remote: Total 146 (delta 51), reused 108 (delta 23), pack-reused 0
C:\Users\navee\projects>cd docker-lumen-app
---- I CHANGED entrypoint.sh HERE, SEE DIFF BELOW -----
C:\Users\navee\projects\docker-lumen-app>git diff
warning: LF will be replaced by CRLF in container/entrypoint.sh.
The file will have its original line endings in your working directory
diff --git a/container/entrypoint.sh b/container/entrypoint.sh
index 4465dde..b75515f 100755
--- a/container/entrypoint.sh
+++ b/container/entrypoint.sh
@@ -1,5 +1,7 @@
#!/bin/sh
+echo Starting container ... <---- this is what i added in entrypoint.sh
+
if [ ! -d ./vendor ]; then
composer install
fi
C:\Users\navee\projects\docker-lumen-app>docker compose build --no-cache
[+] Building 19.6s (17/17) FINISHED
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 1.53kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load metadata for docker.io/library/alpine:3.14 1.3s
=> [internal] load build context 0.0s
=> => transferring context: 297.22kB 0.0s
=> CACHED [ 1/12] FROM docker.io/library/alpine:3.14@sha256:0f2d5c38dd7a4f4f733e688e3a6733cb5ab1ac6e3cb4603a5dd564e5bfb80eed 0.0s
=> [ 2/12] RUN apk --no-cache add curl nginx php8 php8-ctype php8-curl php8-dom php8-fpm php8-gd php8-intl php8-json php8-mbstring php8-mysqli php8-opcache php8-openssl php8-phar 4.2s
=> [ 3/12] RUN ln -s /usr/bin/php8 /usr/bin/php 0.4s
=> [ 4/12] RUN curl -sS https://getcomposer.org/installer | php && chmod +x composer.phar && mv composer.phar /usr/local/bin/composer 3.0s
=> [ 5/12] COPY container/nginx.conf /etc/nginx/nginx.conf 0.0s
=> [ 6/12] COPY container/fpm-pool.conf /etc/php8/php-fpm.d/www.conf 0.0s
=> [ 7/12] COPY container/php.ini /etc/php8/conf.d/custom.ini 0.0s
=> [ 8/12] COPY container/supervisord.conf /etc/supervisor/conf.d/supervisord.conf 0.0s
=> [ 9/12] COPY container/entrypoint.sh /entrypoint.sh 0.0s
=> [10/12] WORKDIR /var/www 0.0s
=> [11/12] COPY src/ /var/www/ 0.0s
=> [12/12] RUN composer install --prefer-dist --no-dev 9.6s
=> exporting to image 0.8s
=> => exporting layers 0.8s
=> => writing image sha256:525a295f6855f0336e63205f7bbfdb7377ef0169fbd50ef9563bd46e5dc02b8b 0.0s
=> => naming to docker.io/library/docker-lumen-app_web 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
C:\Users\navee\projects\docker-lumen-app>docker compose up --force-recreate
[+] Running 4/4
- Network docker-lumen-app_default Created 0.0s
- Container docker-lumen-app-redis-1 Created 0.8s
- Container docker-lumen-app-db-1 Created 0.8s
- Container docker-lumen-app-web-1 Created 0.1s
Attaching to docker-lumen-app-db-1, docker-lumen-app-redis-1, docker-lumen-app-web-1
docker-lumen-app-redis-1 | 1:C 02 Nov 2023 08:41:21.450 # WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition. Being disabled, it can also cause failures without low memory condition, see https://github.com/jemalloc/jemalloc/issues/1328. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
docker-lumen-app-redis-1 | 1:C 02 Nov 2023 08:41:21.450 * oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
docker-lumen-app-redis-1 | 1:C 02 Nov 2023 08:41:21.450 * Redis version=7.2.2, bits=64, commit=00000000, modified=0, pid=1, just started
docker-lumen-app-redis-1 | 1:C 02 Nov 2023 08:41:21.450 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
docker-lumen-app-redis-1 | 1:M 02 Nov 2023 08:41:21.451 * monotonic clock: POSIX clock_gettime
docker-lumen-app-redis-1 | 1:M 02 Nov 2023 08:41:21.451 * Running mode=standalone, port=6379.
docker-lumen-app-redis-1 | 1:M 02 Nov 2023 08:41:21.452 * Server initialized
docker-lumen-app-redis-1 | 1:M 02 Nov 2023 08:41:21.452 * Ready to accept connections tcp
docker-lumen-app-db-1 | 2023-11-02 08:41:21+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.2.0-1.el8 started.
docker-lumen-app-db-1 | 2023-11-02 08:41:21+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
docker-lumen-app-db-1 | 2023-11-02 08:41:21+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.2.0-1.el8 started.
docker-lumen-app-db-1 | 2023-11-02 08:41:22+00:00 [Note] [Entrypoint]: Initializing database files
docker-lumen-app-db-1 | 2023-11-02T08:41:22.184920Z 0 [System] [MY-015017] [Server] MySQL Server Initialization - start.
docker-lumen-app-db-1 | 2023-11-02T08:41:22.186604Z 0 [Warning] [MY-011068] [Server] The syntax '--skip-host-cache' is deprecated and will be removed in a future release. Please use SET GLOBAL host_cache_size=0 instead.
docker-lumen-app-db-1 | 2023-11-02T08:41:22.186930Z 0 [Warning] [MY-010918] [Server] 'default_authentication_plugin' is deprecated and will be removed in a future release. Please use authentication_policy instead.
docker-lumen-app-db-1 | 2023-11-02T08:41:22.186956Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.2.0) initializing of server in progress as process 82
docker-lumen-app-db-1 | 2023-11-02T08:41:22.196429Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
docker-lumen-app-db-1 | 2023-11-02T08:41:22.204548Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
docker-lumen-app-web-1 | Starting container ...
docker-lumen-app-web-1 | Installing dependencies from lock file (including require-dev)
docker-lumen-app-web-1 | Verifying lock file contents can be installed on current platform.
docker-lumen-app-web-1 | Package operations: 107 installs, 0 updates, 0 removals
docker-lumen-app-web-1 | - Downloading fakerphp/faker (v1.17.0)
docker-lumen-app-db-1 | 2023-11-02T08:41:23.128056Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
docker-lumen-app-web-1 | - Downloading hamcrest/hamcrest-php (v2.0.1)
docker-lumen-app-web-1 | - Downloading mockery/mockery (1.4.4)
docker-lumen-app-web-1 | - Downloading phpdocumentor/reflection-common (2.2.0)
docker-lumen-app-web-1 | - Downloading phpdocumentor/type-resolver (1.5.1)
docker-lumen-app-web-1 | - Downloading phpdocumentor/reflection-docblock (5.3.0)
....
Now it's working! I am so much thankful, that you helped me so detailed.
Issue will be closed now.
Hi, I've done the little steps from your website https://effective-programmer.com/quick-web-application-setup-using-php8-lumen-and-docker-eba310d1996a. But when I start the container "docker-lumen-app-web", the container stops and in the logfile I can find the message "exec /entrypoint.sh: no such file or directory". Why does it happen?
Greetings, Sandra