A "light" user of cannabis who was caught with €3,000 worth of the drug had come under pressure to keep it in his home at the time, a court heard.
Luke Quigley (19) was a young man who made a "huge mistake", his lawyer said.
Judge Flann Brennan adjourned the case for the production of a probation report.
Quigley pleaded guilty to possession of a knife and cannabis when he was stopped at Bangor Drive, Crumlin, and having the drug with intent to sell or supply at his home at Mourne Road, Drimnagh, last January 8.
Dublin District Court heard Quigley was arrested after he fled from gardaí.
A hunting knife and cannabis were found on him, with a further €3,000 worth of the drug seized in a follow-up search at his home.
Quigley, who had no previous convictions, made full admissions and took responsibility for the drugs found.
He had been a light cannabis user who came under press- ure from people to "hold the drugs" at his family home, his lawyer said.
The accused no longer associated with these people.
He was a young person who made a "huge mistake", she added.