Problems and Fixes for LFS261 - LAB 7
Working on Lab 7 I found a number of inconsistencies that if you follow the lab you won't be able to run nor build your docker images. First the Javascript code isn't compatible with the node docker image version that you're told in the lab node:18-slim you need to use node:8.9.0-slim. After you've changed the version of node, these command will finaly work :
npm install -this will install modules from package.json npm audit fix -this will fix known vulnerabilities in the modules installed by npm npm ls - lists all modules downloaded by npm npm test - runs unit tests to verify your code is ok npm start
In the next step you're instructed to create a Dockerfile inside the result/ using the following:
FROM node:18-slim
RUN apt-get update && \
apt-get install -y --no-install-recommends curl tini && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/local/app
RUN npm install -g nodemon
COPY package*.json ./
RUN npm ci && \
npm cache clean --force && \
mv /usr/local/app/node_modules /node_modules
COPY . .
ENV PORT 80
EXPOSE 80
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["node", "server.js"]
This Dockerfile has a number of additional problems:
- We already know that node 18 won't work, so we need to use node 8.9.0
- the docker image
node:8.9.0-slimis based on an old Debian version (Debian 8.11"Jessie") that is no longer supported, so you can't runapt-get updatenor install curl or tini. - To fix this issue I had to build my own docker image using a more recent Debian version (Debian 11 "Bullseye") and install node 8.9.0 in it
- the command
npm ciisn't a command fornpm 5.5.1(that's the version of npm that comes with node 8.9.0). So you have to replace it withnpm install
At the end my new modified Dockerfile for results/ is:
FROM <my custom docker image>
RUN apt update && \
apt-get install -y --no-install-recommends curl tini nano && \
rm -rf /var/lib/apt/lists/*
WORKDIR /usr/local/app
RUN npm install nodemon -g
COPY package.json ./
RUN npm install && \
npm cache clean --force && \
mv /usr/local/app/node_modules /node_modules
COPY . .
ENV PORT 80
EXPOSE 80
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD [ "node", "server.js" ]
Comments
-
BTW the problem with node 18 is a known issue that was posted back in January 2022. you can see the post here
0 -
Thanks for giving me a heads up on this! This was all updated in July, including the source code so that it would work with node 18 I believe. I'll look further into this to see what needs to be changed.
1 -
Hi @jcasanas,
I did a test case and I confirmed that the Dockerfile is working with 18-slim since the change on the file

Regards,
Luis.0
Categories
- All Categories
- 175 LFX Mentorship
- 175 LFX Mentorship: Linux Kernel
- 745 Linux Foundation IT Professional Programs
- 372 Cloud Engineer IT Professional Program
- 168 Advanced Cloud Engineer IT Professional Program
- 73 DevOps IT Professional Program - Discontinued
- 3 DevOps & GitOps IT Professional Program
- 98 Cloud Native Developer IT Professional Program
- 7.6K Training Courses & Learning Paths
- AI & ML Training
- Blockchain & Decentralized Identity Training
- 1 Cloud & Containers Training
- Cybersecurity Training
- DevOps & Site-Reliability Training
- Linux Kernel Development Training
- Networking Training
- Open Source Best Practice Training
- System Administration Training
- System Engineering Training
- Web & Application Development Training
- 2 LFD103-JP クラス フォーラム
- 4 LFD210-CN Class Forum
- 764 LFD259 Class Forum
- 681 LFS101 Class Forum
- 2 LFS158-JP クラス フォーラム
- 162 LFS207 Class Forum
- 3 LFS207-DE-Klassenforum
- 4 LFS207-JP クラス フォーラム
- 61 LFS241 Class Forum
- 52 LFS242 Class Forum
- 42 LFS243 Class Forum
- 19 LFS244 Class Forum
- 4 LFS250-JP クラス フォーラム
- 166 LFS253 Class Forum
- 1.4K LFS258 Class Forum
- 792 Hardware
- 202 Drivers
- 68 I/O Devices
- 37 Monitors
- 95 Multimedia
- 173 Networking
- 91 Printers & Scanners
- 87 Storage
- 768 Linux Distributions
- 81 Debian
- 67 Fedora
- 22 Linux Mint
- 13 Mageia
- 24 openSUSE
- 150 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 465 Linux System Administration
- 31 Cloud Computing
- 73 Command Line/Scripting
- Github systems admin projects
- 98 Linux Security
- 78 Network Management
- 101 System Management
- 46 Web Management
- 106 Mobile Computing
- 18 Android
- 73 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 392 Off Topic
- 121 Introductions
- 181 Small Talk
- 29 Study Material
- 945 Programming and Development
- 310 Kernel Development
- 617 Software Development
- 978 Software
- 370 Applications
- 182 Command Line
- 5 Compiling/Installing
- 68 Games
- 317 Installation
- Archived
- 2 LFD140 Class Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)