Context: "Knockin' on Heaven's Door" is a song written and sung by Bob Dylan, for the soundtrack of the 1973 film Pat Garrett and Billy the Kid. Released as a single, it reached No. 12 on the Billboard Hot 100 singles chart. Described by Dylan biographer Clinton Heylin as "an exercise in splendid simplicity," the song, measured simply in terms of the number of other artists who have covered it, is one of Dylan's most popular post-1960s compositions.

Question: who wrote the song knocking on heaven's door?
Steam of consciousness below:
The relevant sentence in the passage is: "Knockin' on Heaven's Door" is a song written and sung by Bob Dylan, for the soundtrack of the 1973 film Pat Garrett and Billy the Kid.
So, the answer is Bob Dylan.