Best Practices for Maintaining Older Ubuntu Docker Containers

November 18, 2025 4 answers
Asked by short-list candidate
I'm working with some older Docker containers based on Ubuntu 16.04 and 18.04. Occasionally, I rebuild these containers, but I'm running into issues where certain apt packages are no longer available. I've had to compile some packages from source to get around this. What are the best practices for maintaining these containers? Should I save the packages internally? Thanks in advance!

Answers

MONDAY LOGIC
You could try pinning the version of Ubuntu or the specific packages, but keep in mind that rebuilding the image will attempt to download everything fresh each time. So, it might not fully solve the problem if the packages are missing from the repositories.

_around_the_corner_: True, pinning can help, but I'm facing the same issue with packages disappearing from PPAs.

Reply to this answer
..outtakes
There isn't a one-size-fits-all answer. One approach is to create your own repository and cache those packages. Alternatively, consider updating your applications to work with newer Ubuntu versions; it's a more future-proof solution.

short-list candidate: I'm leaning towards creating an internal cache for the packages. It seems like a good way to handle this.

Reply to this answer
+practice restraint
Have you thought about just upgrading your base images? Sticking with EOL systems can pose security risks and might be more of a hassle than it's worth. It could save you more time in the long run.

short-list candidate: We actually need to maintain the original container environment for compatibility with production builds.

Reply to this answer
quail habitat
Just so you know, standard support for Ubuntu lasts about 5 years, so keeping these older versions means you might face more issues down the line.

short-list candidate: Yep, I'm aware of that. Just trying to keep things stable for now.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions