emad-zaamout / Laravel-Complete-Dockerization

https://ahtcloud.com
70 stars 86 forks source link

Facing issue in ubuntu 22.04 while dockerizing my laravel project. #1

Open devsohail opened 1 year ago

devsohail commented 1 year ago

Hi, I have followed all the procedure of dockerization my laravel project as per your video you youtube as well code exactly copied from Git, but unfortunately I a facing error. Can you please help me in this regard.

Error is Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "docker/entrypoint.sh": stat docker/entrypoint.sh: no such file or directory: unknown

Detail is Below

sohail@:/var/www/appointmentconfigurations$ docker-compose down --volumes [+] Running 4/4 ⠿ Container appointmentconfigurations-php-1 Removed 0.0s ⠿ Container postgresql Removed 0.3s ⠿ Volume appointmentconfigurations_db-data Removed 0.2s ⠿ Network appointmentconfigurations_default Removed 0.2s sohail@sohail-Inspiron-15-3511:/var/www/appointmentconfigurations$ docker-compose build [+] Building 60.0s (15/16)
=> [internal] load build definition from Dockerfile 0.0s [+] Building 61.4s (11/14)
=> => transferring dockerfile: 425B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/php:7.4 4.6s => [auth] library/php:pull token for registry-1.docker.io 0.0s => [internal] load build context 7.9s => => transferring context: 282.75MB 7.6s => CACHED FROM docker.io/library/composer:2.3.10 4.3s => => resolve docker.io/library/composer:2.3.10 4.3s => [php 1/8] FROM docker.io/library/php:7.4@sha256:620a6b9f4d4feef2210026172570465e9d0c1de79766418d3affd09190a7fda5 0.0s => CACHED [php 2/8] RUN apt-get update -y 0.0s => CACHED [php 3/8] RUN apt-get install -y unzip libpq-dev libcurl4-gnutls-dev 0.0s => CACHED [php 4/8] RUN docker-php-ext-install pdo pdo_pgsql bcmath 0.0s => [php 5/8] RUN pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis 47.5s => [auth] library/composer:pull token for registry-1.docker.io 0.0s [+] Building 61.7s (16/16) FINISHED
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 425B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/php:7.4 4.6s [+] Building 61.5s (12/14)
=> [internal] load build definition from Dockerfile 0.0s => => transferring dockerfile: 425B 0.0s => [internal] load .dockerignore 0.0s => => transferring context: 2B 0.0s => [internal] load metadata for docker.io/library/php:7.4 4.5s => CACHED FROM docker.io/library/composer:2.3.10 4.3s => => resolve docker.io/library/composer:2.3.10 4.3s => [php 1/8] FROM docker.io/library/php:7.4@sha256:620a6b9f4d4feef2210026172570465e9d0c1de79766418d3affd09190a7fda5 0.0s => [internal] load build context 1.4s => => transferring context: 1.74MB 1.3s => CACHED [php 2/8] RUN apt-get update -y 0.0s => CACHED [php 3/8] RUN apt-get install -y unzip libpq-dev libcurl4-gnutls-dev 0.0s => CACHED [php 4/8] RUN docker-php-ext-install pdo pdo_pgsql bcmath 0.0s => [php 5/8] RUN pecl install -o -f redis && rm -rf /tmp/pear && docker-php-ext-enable redis 47.5s => [php 6/8] WORKDIR /var/www 0.0s => exporting to image 5.6s => => exporting layers 5.6s => => writing image sha256:97c11d44877ff3d492cb786c5a2c7b6ada912bae7745b195b066835006ce23d3 0.0s => => naming to docker.io/library/appointmentconfigurations-php

sohail@:/var/www/appointmentconfigurations$ docker-compose up [+] Running 7/7 ⠿ redis Pulled 11.9s ⠿ 63b65145d645 Already exists 0.0s ⠿ 6a83e1b979d3 Pull complete 2.3s ⠿ 33568fda55fd Pull complete 2.9s ⠿ d7b8c87f98b0 Pull complete 4.3s ⠿ a233cbd936e4 Pull complete 4.4s ⠿ 8182adae0173 Pull complete 4.5s [+] Running 0/1 [+] Running 6/6intmentconfigurations_default Creating 0.1s ⠿ Network appointmentconfigurations_default Created 0.2s ⠿ Volume "appointmentconfigurations_db-data" Created 0.0s ⠿ Container appointmentconfigurations-redis-1 Created 0.2s ⠿ Container appointmentconfigurations-database-1 Created 0.2s ⠿ Container appointmentconfigurations-websocket-1 Created 0.2s ⠿ Container appointmentconfigurations-php-1 Created 0.2s Attaching to appointmentconfigurations-database-1, appointmentconfigurations-php-1, appointmentconfigurations-redis-1, appointmentconfigurations-websocket-1 appointmentconfigurations-redis-1 | 1:C 08 Mar 2023 11:59:28.434 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo appointmentconfigurations-redis-1 | 1:C 08 Mar 2023 11:59:28.434 # Redis version=7.0.9, bits=64, commit=00000000, modified=0, pid=1, just started appointmentconfigurations-redis-1 | 1:C 08 Mar 2023 11:59:28.434 # Configuration loaded appointmentconfigurations-redis-1 | 1:M 08 Mar 2023 11:59:28.436 monotonic clock: POSIX clock_gettime appointmentconfigurations-redis-1 | 1:M 08 Mar 2023 11:59:28.438 Running mode=standalone, port=6379. appointmentconfigurations-redis-1 | 1:M 08 Mar 2023 11:59:28.438 # Server initialized appointmentconfigurations-redis-1 | 1:M 08 Mar 2023 11:59:28.455 Creating AOF base file appendonly.aof.1.base.rdb on server start appointmentconfigurations-redis-1 | 1:M 08 Mar 2023 11:59:28.482 Creating AOF incr file appendonly.aof.1.incr.aof on server start appointmentconfigurations-redis-1 | 1:M 08 Mar 2023 11:59:28.482 * Ready to accept connections appointmentconfigurations-database-1 | **** appointmentconfigurations-database-1 | WARNING: POSTGRES_HOST_AUTH_METHOD has been set to "trust". This will allow appointmentconfigurations-database-1 | anyone with access to the Postgres port to access your database without appointmentconfigurations-database-1 | a password, even if POSTGRES_PASSWORD is set. See PostgreSQL appointmentconfigurations-database-1 | documentation about "trust": appointmentconfigurations-database-1 | https://www.postgresql.org/docs/current/auth-trust.html appointmentconfigurations-database-1 | In Docker's default configuration, this is effectively any other appointmentconfigurations-database-1 | container on the same system. appointmentconfigurations-database-1 | appointmentconfigurations-database-1 | It is not recommended to use POSTGRES_HOST_AUTH_METHOD=trust. Replace appointmentconfigurations-database-1 | it with "-e POSTGRES_PASSWORD=password" instead to set a password in appointmentconfigurations-database-1 | "docker run". appointmentconfigurations-database-1 | **** appointmentconfigurations-database-1 | The files belonging to this database system will be owned by user "postgres". appointmentconfigurations-database-1 | This user must also own the server process. appointmentconfigurations-database-1 | appointmentconfigurations-database-1 | The database cluster will be initialized with locale "en_US.utf8". appointmentconfigurations-database-1 | The default database encoding has accordingly been set to "UTF8". appointmentconfigurations-database-1 | The default text search configuration will be set to "english". appointmentconfigurations-database-1 | appointmentconfigurations-database-1 | Data page checksums are disabled. appointmentconfigurations-database-1 | appointmentconfigurations-database-1 | fixing permissions on existing directory /var/lib/postgresql/data ... ok appointmentconfigurations-database-1 | creating subdirectories ... ok appointmentconfigurations-database-1 | selecting dynamic shared memory implementation ... posix appointmentconfigurations-database-1 | selecting default max_connections ... 100 appointmentconfigurations-database-1 | selecting default shared_buffers ... 128MB appointmentconfigurations-database-1 | selecting default time zone ... UTC appointmentconfigurations-database-1 | creating configuration files ... ok Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "docker/entrypoint.sh": stat docker/entrypoint.sh: no such file or directory: unknown

stefanoradice commented 1 year ago

Hi, you need to change the entrypoint.sh file's permissions in host, open terminal into your laravel project folder and run this command: chmod +x ./docker/entrypoint.sh after that you can run command: docker-compose down -v && docker-compose up --build and should be ok.

karlog100 commented 1 year ago

I had the same issue, the comment from @stefanoradice resolved the issue for me.

I had to run the command in my wsl terminal and not inside the Dockerfile.

fatihalp commented 1 year ago

Same problem here fixed thanks @stefanoradice