I'm trying to understand this sentence. I have set the "which" in bold:

If you start a container which creates a new volume, as above, and the container has files or directories in the directory to be mounted (such as /app/ above), the directory’s contents are copied into the volume.

Why doesn't this sentence use a comma before "which" (i.e. "[...] container, which creates [...]")?

When should I use a comma before "which", and what's the difference?

  • Because "which creates a new volume" is an integral part describing a particular container type (a container with a volume), you can't left it out. Jan 12 at 14:24
  • The grammar you're looking for is defining relative clause (or identifying relative clause) vs non-defining relative clause (or non-identifying relative clause). There's tons of info about this on the Internet.
    – gotube
    Jan 12 at 23:28

Because in English, a restrictive relative clause (one that contributes to specifying the noun phrase it is attached to) is not set off as a separate breath group, and so is not written with a comma.

Here which creates a new volume is not an incidental comment about the container, but is specifying the container, so it is a restrictive clause.


You have possibly been taught that 'which' introduces a non-restrictive clause and should always be preceded by a comma, while 'that' introduces a restrictive clause and does not have a comma.

By that rule, your example should use 'that' and omit the comma, as it is identifying or defining the kind of container being spoken about.

Webster's dictionary notes that, in modern English, 'which' can introduce either kind of clause, suggesting that the 'rule' is no longer followed, but grammar nuts may disagree. Personally, I like to follow the rule in written English.

  • I think the use of "which" (without commas) to introduce a restrictive clause is also more common in British English than in American English.
    – V2Blast
    Jan 12 at 22:23

Not the answer you're looking for? Browse other questions tagged .