In other words, it could be said that the obligation of continence (or of celibacy) became canon law only in the fourth century but that, before that, from apostolic times, the ideal of living in continence (or in celibacy) was already held up to the ministers of the Church, and that this ideal was indeed deeply felt and lived as a requirement by quite a number (Tertullian and Origen, for instance) but was not yet imposed on all clerics in major orders. It was a vital principle, a seed, clearly present from apostolic times but which gradually then developed until the ecclesiastical legislation of the fourth century.
There is much more in the article about continence. I just picked out one of the references.
First conciliar legislation regarding lex continentiae: Canons XXVII and XXXIII of the Council of Elvira 295-302 Anno Domini.