I have fairly limited experience in docker and I’ve been trying to run
docker-compose build
on a project I need to run. I’m using docker in windows 10.
The build has been stopping every few seconds and has been giving me different errors, like:
W: The repository 'http://security.debian.org/debian-security stretch/updates Release' does not have a Release file.
when running RUN apt-get update
,
E: Unable to locate package mysql-client
when running RUN apt-get -y install mysql-client
etc.
While I have been able to solve the former error, I’ve been trying to get it to install mysql-client for a while now and It just keeps throwing one error or another, despite the changes I’ve made to the dockerfile. (I’ve tried changing the line to RUN apt-get -y install default-mysql-client
)
This is my dockerfile:
FROM node:10
RUN echo "UTC" > /etc/timezone
RUN dpkg-reconfigure -f noninteractive tzdata
RUN apt-get update
RUN apt-get -y install mysql-client
RUN mkdir /usr/homework1
RUN mkdir /usr/homework2
RUN mkdir /usr/homework3
My question is, why is this happening? I built the same project on ubuntu about a year ago and it worked just fine. Is there a way to stop it from giving me so many errors? The project has about 10 containers, will I need to go step by step on every single dockerfile? Is it because of the docker-compose version? I’m currently using
Docker Compose version v2.23.0-desktop.1
2
Answers
The
node:10
image is old and based on Debian 9 (called ‘stretch’). Support for Debian 9 stopped in 2022. That’s why the package manager can’t find the packages you want to install.Node 10 is also out of support since 2021.
You should move to a newer version of Node and Debian. The latest LTS version of Node is version 20, so that might be a good candidate. To use it, change your
FROM
statement toThat image uses Debian 12 (called ‘bookworm’) which will be supported until 2028.
If for some reason you still want to use
node:10
even though it is no longer supported, add it before the RUN apt-get update