bitnami / containers

Bitnami container images
https://bitnami.com
Other
3.28k stars 4.76k forks source link

[bitnami/laravel] Error in "/app/vendor/autoload.php" #30800

Closed siavashfazli closed 1 year ago

siavashfazli commented 1 year ago

Name and Version

bitnami/laravel:9.5.2

What architecture are you using?

amd64

What steps will reproduce the bug?

I use the bitnami/laravel docker image to run my laravel project on a Ubuntu 22.04 server. Also, I use the default docker-compose.yml to run it.

Before, I used the PHP docker image and ran "composer install" etc... manually. As I understood this image run commands automatically.

This is my docker-compose.yml:

version: "3.9"
services:
  messenger:
    container_name: messenger-service
    image: bitnami/laravel:9.5.2
    restart: always
    user: root
    volumes:
      - ./www/notification-service:/app
    depends_on:
      - messenger-db
    working_dir: /app
    networks:
      - main-nginx-net
#-------------------------------------#
  messenger-db:
    container_name: messenger-db
    image: mysql:8.0.29
    volumes:
      - ./vol_messenger-db:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
      MYSQL_DATABASE: ${MYSQL_DATABASE}
      MYSQL_USER: ${MYSQL_USER}
      MYSQL_PASSWORD: ${MYSQL_PASSWORD}
    ports:
      - "3306:3306"
    cap_add:
      - SYS_NICE
    networks:
      - main-nginx-net
    restart: always
networks:
  main-nginx-net:
    external: true

When I run docker compose up -d , I got this error in docker logs:

What is the expected behavior?

No response

What do you see instead?

laravel 10:48:10.26 Welcome to the Bitnami laravel container
laravel 10:48:10.26 Subscribe to project updates by watching https://github.com/bitnami/containers
laravel 10:48:10.27 Submit issues and feature requests at https://github.com/bitnami/containers/issues
laravel 10:48:10.27
laravel 10:48:10.27 INFO  ==> ** Running Laravel setup **
laravel 10:48:10.33 INFO  ==> Configuring PHP options
laravel 10:48:10.33 INFO  ==> Setting PHP opcache.enable option
laravel 10:48:10.35 INFO  ==> Setting PHP expose_php option
laravel 10:48:10.40 INFO  ==> Validating settings in LARAVEL_* environment variables...
laravel 10:48:10.41 WARN  ==> Hostname mariadb could not be resolved, this could lead to connection issues
laravel 10:48:10.43 INFO  ==> An existing project was detected, skipping project creation
laravel 10:48:10.44 INFO  ==> ** Laravel setup finished! **

laravel 10:48:10.47 INFO  ==> ** Starting Laravel project **
[18-Apr-2023 10:48:10 UTC] PHP Warning:  require(/app/vendor/autoload.php): Failed to open stream: No such file or directory in /app/artisan on line 18
[18-Apr-2023 10:48:10 UTC] PHP Fatal error:  Uncaught Error: Failed opening required '/app/vendor/autoload.php' (include_path='.:/opt/bitnami/php/lib/php') in /app/artisan:18
Stack trace:
#0 {main}
  thrown in /app/artisan on line 18

Additional information

Any suggests?

carrodher commented 1 year ago

Please, note that the Bitnami team is not actively monitoring GitHub Issues for this project. This issue will stay open for 20 days to allow the community to contribute, after 15 days without activity the issue will be marked as stale, being closed after 5 days.

If you would like to contribute to this container image by fixing a bug or adding a new feature, feel free to create a PR, the Bitnami team will be happy to review it and provide feedback.

foxmasters commented 1 year ago

I have the same problem, I cannot run existing applications, apparently it is a permission issue to be able to create the vendor folder when the container runs composer install.

Have you found any solution?

siavashfazli commented 1 year ago

@foxmasters I solved the problem by Dockerfile.

I just COPY the project into Dockerfile and RUN composer install.

github-actions[bot] commented 1 year ago

This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.

github-actions[bot] commented 1 year ago

Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.

Nickno95 commented 1 year ago

@foxmasters I solved the problem by Dockerfile.

I just COPY the project into Dockerfile and RUN composer install.

Can you go into more detail on how to do this solution? I'm running into this issue and not sure how to go about what you are describing.

brunocunha00 commented 1 week ago

Did you run composer update or install?