1

I'm new to Docker and trying to get my head around extending existing Images.

I understand you can extend an existing Docker image using the FROM command in a Dockerfile (e.g. How to extend an existing docker image?), but my question is -- in general, how can I install additional software / packages without knowing what the base operating system is of the base image or which package manager is available?

Or am I thinking about this the wrong way?

Community
  • 1
  • 1
Marco Benvoglio
  • 1,283
  • 2
  • 12
  • 17

2 Answers2

1

The best practice is to run the base image you want to start FROM (perhaps using docker exec) and see what package managers are available (if any). Then you can write your Dockerfile with the correct software installation procedure.

Think of it the same way you'd add software to any computer: you'd either log into it yourself and poke around, or write an installation program that can handle all of the expected variations.

Andy
  • 35,844
  • 6
  • 43
  • 50
0

In most cases, the source Dockerfile is provided and you can walk the chain backwards and gain a better understanding as you do.

For example, if we look at the official Redis image we see the information tab says

Supported tags and respective Dockerfile links

So if you're interested in building off redis:latest you'd follow the second link and see that it in turn is built off of debian:wheezy.

Most user-created images will either include their Dockerfile on the hub page or from a link there.

Nathaniel Waisbrot
  • 23,261
  • 7
  • 71
  • 99