Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Azure fails to load and run the Docker Container #1321

Closed
6 of 7 tasks
entrotech opened this issue Feb 5, 2023 · 2 comments
Closed
6 of 7 tasks

Bug: Azure fails to load and run the Docker Container #1321

entrotech opened this issue Feb 5, 2023 · 2 comments
Labels
bug Release Note: Shows as Error Correction feature: DevOps level: hard priority: MUST HAVE role: back-end Node/Express Development Task size: missing

Comments

@entrotech
Copy link
Member

entrotech commented Feb 5, 2023

Overview

As of 2/4/23, the deployment to Azure in both the Development and Production accounts started failing, preventing release 0.2.43 and updates to the development environment.

Action Items

  • GitHub deployment actions appear to be successful, i.e.,
    image
  • Docker image deployment looks good:
    image
  • Azure logs from Development Azure account show problem with ingesting the docker image:
    image
  • The detailed error messsage reads:

2023-02-05T03:42:33.200Z ERROR - failed to register layer: Error processing tar file(exit status 1): Container ID 718322462 cannot be mapped to a host ID

Resources/Instructions

REPLACE THIS TEXT -If there is a website which has documentation that helps with this issue provide the link(s) here.

@entrotech entrotech self-assigned this Feb 5, 2023
@entrotech entrotech added bug Release Note: Shows as Error Correction role: back-end Node/Express Development Task level: hard priority: MUST HAVE feature: DevOps labels Feb 5, 2023
@entrotech
Copy link
Member Author

entrotech commented Feb 5, 2023

Started by following the instructions from the first article above:

Started debug session using docker on local machine:

$ docker build -t tdmcalc/tdmapp
...

$ docker run -p 5001:5001 --env-file server/.env tdmcalc/tdmapp
server running on port 5001

Then in a separate terminal window, start a linux shell on the running container:

$ docker ps
CONTAINER ID   IMAGE            COMMAND                  CREATED          STATUS          PORTS                    NAMES
6b2977675949   tdmcalc/tdmapp   "/usr/local/bin/node…"   33 seconds ago   Up 26 seconds   0.0.0.0:5001->5001/tcp   sad_edison

johnc@John-ThinkPad MINGW64 /c/git/hackforla/tdm-calculator (develop)
$ docker exec -it 6b2977 sh
/ # ls
app                package-lock.json
bin                package.json
client             proc
dev                root
etc                run
home               sbin
lib                server.js
media              srv
middleware         sys
mnt                tmp
node_modules       usr
opt                var
/ # 

Per the first article in the Issue Description above, look for files that belong to a user with a UID value that is too high:

find / \( -uid 1000000 \) -ls 2>/dev/null

(Didn't find any)

From the same article, look for an NPM-specific issue where it may install node-modules into the node-modules directory with a too high UID for the file owner/creator:

FILES=$(find /app/node_modules/ ! -user root)
ls -lrta $FILES

In this case, there was voluminous output, but among the results were this:
image

So the problem appears to be related to the ownership of NPM installed files. The suggested fix is to modify the Dockerfile to change ownership of the files in node_modules:

As a resolution, we can either downgrade NPM (current Docker Images with Node have NPM preinstalled which are an earlier version than 9) - or - change the ownership of node_modules, like the below:

RUN npm i -g [email protected] && \
    npm i && \
    find /app/node_modules/ ! -user root | xargs chown root:root

Next step is to try to figure out how to modify the Dockerfile...

@entrotech
Copy link
Member Author

entrotech commented Feb 5, 2023

Changes to the Dockerfile in the PR seemed to work - deployed to DEV environment successfully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Release Note: Shows as Error Correction feature: DevOps level: hard priority: MUST HAVE role: back-end Node/Express Development Task size: missing
Projects
Archived in project
Development

No branches or pull requests

2 participants