Here, the word "image" is an attributive noun, i.e. a noun that works as an adjective.
So, the question: should we pluralize attributive nouns or not? It doesn't have "cut and dry" answer. It depends.
I suggest to read an excellent Quick and Dirty Tips article:
(I'm not sure "images directory" is a compound noun, though. I believe it is not.)
And then read the following excerpts from another sources:
The plural is rare in ordinary language, but more common in business and legal contexts. In ordinary language, sports is common before another noun. Other than that, the reason [to use plural] is usually (1) that only the plural noun exists, as in mathematics class, or (2) that the singular and plural have slightly different meanings, as in goods train.
[...] according to some linguists, the use of plural noun modifiers is on the increase - here's Michael Swan on the subject:
Other current changes in small corners of grammar include [...] and a growth in plural marking on noun modifiers (antiques shop, drugs problem, arrivals lounge, ...)
From the same source
And dog food is what dogs eat, a bus stop is where buses stop, and so on for all such combinations - English almost always uses the singular noun here. The plural -s is not needed, because when would you want to distinguish between food for one dog and food for many dogs, or a list with one guest and a list with many guests (guest list)? We don't need the singular/plural distinction.
Yes, sometimes the plural is used attributively. In most cases the singular is standard, in a few cases either singular or plural works (record/records department, veteran/veterans office) and in a few (such as sales department) the plural is standard.
There is no rule about whether the attributive noun is singular or plural. Most of the time it is singular. But if the combination of nouns includes a plural noun, it usually stays that way. The result is phrases like ladies room – not lady room, for a room meant for women and girls, and bean soup but not beans soup for a soup made of beans.
Some grammar experts think that English speakers are using more plural nouns in this way. We have arms race, benefits office, and women leaders. At times, a singular noun changes the meaning. An arts degree recognizes completion of a study program at a college or university in the humanities (or liberal arts). But an art degree is a degree in the fine arts.
- Generally, use the singular form.
- When you need to avoid an ambiguity, use the plural form.
Image directory looks potentially ambiguous. It's not clear: is it a directory to store the images, or is it a directory where some particular image is located? That's why IBM use plural form here.
Asciidoctor User Manual, which is very good and accurate written/edited, use the plural form as well:
iconsdir and so on.