Michael O'Leary, 47, was told he posed a significant to risk to woman after a jury heard he spent hours trawling the streets looking for a vulnerable victim.
The sex offender preyed on the 36-year-old mum after she left a bar heavily drunk and incapable of looking after herself.
O'Leary took her back to his council flat in Belle Isle, Leeds, where she was held captive for almost 24 hours.
She was locked inside the property as O'Leary subjected her to violence and tried to rape her.
"You went out that night with the intention of selecting someone so drunk you could get them back to your house and commit sexual acts on them for your own gratification.
"You used significant violence in an attempt to rape her. She resisted you.
"She stood her ground even though you had a knife. She took the view that if she had to die trying to escape from you then that is what she would have to do."
O'Leary was found guilty of attempted rape, assault by penetration and false imprisonment after a trial in March this year.
The court heard O'Leary has a previous conviction for violently raping a woman when he was aged 28.
On that occasion he coaxed a 35-year-old woman back to his flat in Chapeltown, Leeds.
Passing the life sentence, Recorder Woolfall said: "I am satisfied that you represent a significant risk of causing serious harm by committing sexual offences.
"This is a sentence of last resort and the decision is not taken lightly."
O'Leary was told he must serve a minimum of seven years in prison but was warned he is likely to spend much longer in custody.
He will only be released when the parole board considers it safe to do so.
After the case, Detective Inspector Phil Jackson, of Leeds District CID, said: "O'Leary held the victim captive and put her through an absolutely terrifying ordeal over a prolonged period during which she genuinely feared he was going to kill her.
"A detailed and comprehensive investigation showed O'Leary had spent a number of hours in the city centre looking for a victim to target. He has previously been convicted of a similar offence and he is clearly a dangerous individual with a predatory nature.
"We hope the significant sentence he has received will provide some degree of comfort to the victim and will also serve as reassurance to the wider community."