0
0
Laravelframework~10 mins

Docker deployment in Laravel - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the base image for a Laravel Docker container.

Laravel
FROM [1]
Drag options to blanks, or click blank then click option'
Amysql:5.7
Bnode:14
Cubuntu:latest
Dphp:8.1-fpm
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a Node.js or MySQL image as the base image.
Using a generic Ubuntu image without PHP installed.
2fill in blank
medium

Complete the Dockerfile command to copy the Laravel application files into the container.

Laravel
COPY [1] /var/www/html
Drag options to blanks, or click blank then click option'
A.
Bsrc/
Capp/
Dpublic/
Attempts:
3 left
💡 Hint
Common Mistakes
Copying only the src/ or app/ folder which misses other important files.
Copying only the public/ folder which is incomplete.
3fill in blank
hard

Fix the error in the Dockerfile command to install Laravel dependencies using Composer.

Laravel
RUN composer [1] --no-dev --optimize-autoloader
Drag options to blanks, or click blank then click option'
Aupdate
Binstall
Crequire
Ddump-autoload
Attempts:
3 left
💡 Hint
Common Mistakes
Using composer update which updates packages instead of installing locked versions.
Using composer require which adds new packages.
Using dump-autoload which only regenerates autoload files.
4fill in blank
hard

Fill both blanks to expose the correct port and set the working directory in the Dockerfile.

Laravel
EXPOSE [1]
WORKDIR [2]
Drag options to blanks, or click blank then click option'
A8000
B/var/www/html
C8080
D/app
Attempts:
3 left
💡 Hint
Common Mistakes
Exposing port 8080 which is not default for Laravel.
Setting working directory to /app which is not where files are copied.
5fill in blank
hard

Fill all three blanks to define a Docker Compose service for Laravel with build context, ports, and volumes.

Laravel
services:
  app:
    build: [1]
    ports:
      - "[2]:8000"
    volumes:
      - [3]:/var/www/html
Drag options to blanks, or click blank then click option'
A.
B8000
C./src
D./app
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong build context folder that lacks Dockerfile.
Mapping wrong ports causing connection issues.
Mounting incorrect volume path that misses app files.