Unable to validate docker task

Hello,

Not sure what’s wrong with this task “Docker Node App” as I keep getting validation errors even when everything is done correctly and the image name was named as per the task, yet it won’t validate.
Here is the link to the review:
https://engineer.kodekloud.com/public-review?task_id=6481fbd05aecb08e6658f91e&user_id=64ad8d8c803455eea0a8a305

The exact same error also with “Docker Python App” but I couldn’t put it under review, maybe because the previous task is already under review

Thanks

Hi @mnidhal, this is indeed a user error:

The issue with the failing task is related to your first COPY instruction: COPY package.json /.
This command copies the package.json file to the root directory of the image, specifically at /package.json. Since you have set your working directory to /opt/app and are copying server.js to that location, the dependencies specified in package.json will not be available in the working directory.

To resolve this, you should update your first COPY instruction to: COPY package.json .
This modification will copy package.json into your working directory (/opt/app), ensuring that the dependencies are accessible when you run your application with server.js.

PS: Once deployed, you can test the app using a curl command on relevant App Server. curl http://localhost:8092

Regards.

Hello @Santosh_KodeKloud

Thank you for the quick reply. You’re right, that was a typo from my end and I didn’t notice it.

I think the reason why I didn’t notice that mistake was the fact the application worked when I tested it with curl and didn’t drop any error, it’s like the dependencies didn’t matter?

The fact that the image was named correctly and the curl worked fine confused me and I didn’t know what was the error

Thanks