Failed to run docker image built by azure contianer registry

Ram S 21 Reputation points

We have build docker image locally and ran it and it works perfect.

If same was done through azure container registry, we are getting the file/module not found issue. So either files are not copied properly or the files path and importing path in code is different.

When we inspected both the images, the image size and especially copy . . command file changes size is different.

I have used vscode to build the docker image in azure container registry.

1st image reflects docker image built in local system, 2nd image reflects the docker image which is pulled from azure container registry

Any help to resolve this issue would be great.

Local system: Mac and node version 16
Azure container registry: Linux and node 16

Error: Cannot find module './src/routes/public'

Require stack:

  • /app/app.js
  • /app/server.js at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15) at Function.Module._load (node:internal/modules/cjs/loader:833:27) at Module.require (node:internal/modules/cjs/loader:1057:19) at require (node:internal/modules/cjs/helpers:103:18) at Object.<anonymous> (/app/app.js:7:1) at Module._compile (node:internal/modules/cjs/loader:1155:14) at Module._compile (/app/node_modules/pirates/lib/index.js:99:24) at Module._extensions..js (node:internal/modules/cjs/loader:1209:10) at Object.newLoader [as .js] (/app/node_modules/pirates/lib/index.js:104:7) at Module.load (node:internal/modules/cjs/loader:1033:32) { code: 'MODULE_NOT_FOUND', requireStack: [ '/app/app.js', '/app/server.js' ]



Azure Container Registry
Azure Container Registry
An Azure service that provides a registry of Docker and Open Container Initiative images.
427 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ryan Hill 27,031 Reputation points Microsoft Employee

    Hi @Ram S ,

    Apologies for the delayed response. Azure Container Registry shouldn't be thought of as building your images. The image you built locally should be pushed to your registry. Based off the error you provided, I surmise that pushed docker image to your container registry doesn't contain your NodeJS app at /src. So, when you pull your image from the registry, it doesn't know what files it should be grabbing a hold of. Have a look at this tutorial on how to push your local image to ACR.

0 additional answers

Sort by: Most helpful