Docker Community Forums

Share and learn in the Docker community.

Issue Starting Application As Described in the Docker Tutorial

Good Afternoon!
I am relatively new to Docker, therefore I was going through the Docker tutorial.

I was attempting to start the application as described here in the tutorial:

Where I obtained the app .zip file and placed it here: C:\Users\aetay

I then built the Dockerfile as described in the tutorial:

FROM node:12-alpine
COPY . .
RUN yarn install --production
CMD [“node”, “/app/src/index.js”]

I was able to run the dockerfile successfully and build the container image using the command:
docker build -t getting-started .

However when I attempted to start the application using the command:
docker run -dp 3000:3000 getting-started

I noticed on the Docker dashboard the error:

throw err;
Error: Cannot find module '/app/src/index.js'

at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)

at Function.Module._load (internal/modules/cjs/loader.js:862:27)

at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)

at internal/main/run_main_module.js:18:47 {


requireStack: []


Per troubleshooting the “index.js” file is located here: C:\Users\aetay\app\src therefore not sure what else I am missing.

Please advise.

With WORKDIR /app and Dockerfile placed at C:\Users\aetay you’ll end up with /app/app/src/index.js in the container.

Place the .zip file in C:\Users\aetay\app instead and rebuild the Docker image.

Just to clarify:

I placed the app .ZIP file in: C:\Users\aetay\app and unzipped the ZIP file in this location so that I have this:

I placed my Dockerfile here: C:\Users\aetay\Dockerfiles

Did a rebuild using the command: docker build -t getting-started . and I ran the command from:

Per the Docker dashboard still seeing the Error: Cannot find module ‘/app/src/index.js’ therefore not sure where Docker is looking when the container is being started to find this index.js file (it doesn’t look like Docker is looking in: C:\Users\aetay\app\src


Place your Dockerfile in C:\Users\aetay\app


After re-arranging where my Dockerfile and app ZIP was located (as shown below) in the screenshot

did a rebuild (using the command: docker build -t getting-started .)

After a successful rebuild started container (using the command: docker run -dp 3000:3000 getting-started)

End result: the application did start up

Thanks for the help.

1 Like