Andrew Beadie, 20, had just been released on licence when he used the 25cm (10in) blade in an alleyway near the Bow Bells pub in November.
Beadie, from Basildon, was cleared of attempted murder but found guilty of assault and wounding with intent.
The Old Bailey heard Beadie thought the officer was a crack addict who was out to get him.
The court was told the stabbing on 22 November happened moments after Beadie beat up another man because he bumped in to him.
Beadie, of Claremont Road, already had a number of convictions, including battery and possession of a knife.
During the trial Det Ch Insp Gary Holmes told the jury it was a "cowardly, unprovoked and sickening knife attack on a police officer" and it was "just sheer luck" the injuries were not life-threatening.
A man who stabbed an undercover Met Police officer with a "Rambo knife" has been jailed for 16 years.