In Catholicism, why can deacons not celebrate all sacraments, but only Baptism (and Matrimony)? According to this post by an expert in Canon Law, deacons can only celebrate the sacrament of Baptism and Matrimony. 

Similarly, Wikipedia states (apparently wrongly) that deacons can only celebrate baptism:


  Deacons, like priests and bishops, are ordinary ministers of the sacrament of Baptism and can serve as the church's witness at the sacrament of Holy Matrimony, which the bride and groom administer to each other (though if the exchange of vows takes place in a wedding Mass, or Nuptial Mass, the Mass is celebrated by the priest and the deacon acts as another witness). Deacons may preside at funeral rites not involving a Mass (e.g., the final commendation at the gravesite or the reception of the body at a service in the funeral home), and may assist the priest at the Requiem Mass. They can preside over various services such as Benediction of the Blessed Sacrament, and they may give certain blessings. They cannot hear confession and give absolution, anoint the sick, or celebrate Mass.


I went to the respective entries in the Canon Law (e.g. Mass celebration here), but they do not state why the restriction (as expected, since it is only law).

I wonder which is the origin of these restrictions, i.e why the deacon cannot celebrate some sacraments. Is this part of the Tradition? I am particularly interested in the celebration of Mass. In fact, since deacons can be married, allowing deacons to celebrate Mass is a proxy for "married priests". This could perhaps be one of the reasons against it?
Confession and Mass (specifically, confection of the Eucharist) are the two sacraments where the priest (under the bishop) stands in the person of Christ. That is, in these two sacraments the priest is acting as if he were Christ, using the powers given by Christ to the apostles and handed down to today's bishops and priests.
A deacon, though he is ordained, does not have the call to ministry that priests (and bishops) do, though he does have the call to service:

&quot;At a lower level of the hierarchy are to be found deacons, who receive the imposition of hands 'not unto the priesthood, but unto the ministry.'&quot; At an ordination to the diaconate only the bishop lays hands on the candidate, thus signifying the deacon's special attachment to the bishop in the tasks of his &quot;diakonia.&quot;
(Catechism of the Catholic Church, paragraph 1569. The quote is from Lumen Gentium, section 29.)

Thus, a deacon, though ordained, does not have the God-given call, and is not given the ability, to stand in persona Christi, &quot;in the person of Christ&quot;.
In Confession, the priest is using the power delegated by Christ to the apostles to forgive sins:

[Jesus] said to them again, &quot;Peace be with you. As the Father has sent me, so I send you.&quot;
And when he had said this, he breathed on them and said to them, &quot;Receive the holy Spirit. Whose sins you forgive are forgiven them, and whose sins you retain are retained.&quot;
John 20:21–23, NABRE

Thus, the priest is, as it were, Christ to the penitent. He is standing here in the person and the ministry of Christ; the deacon is unable to do this.
Similarly, Jesus gave to his apostles the power to confect the Eucharist:

Lord Jesus, on the night he was handed over, took bread, and, after he had given thanks, broke it and said, &quot;This is my body that is for you. Do this in remembrance of me.&quot;
1 Corinthians 11:23–24

Again, this is a delegation to the apostles (and thus to their successors, the bishops and priests) alone; deacons are not called to this ministry.
Finally, it might appear that Anointing of the Sick is a sacrament that may be conferred either by a deacon or by a priest. This sacrament, however, always includes at least an offer for the sick person to confess their sins; and its first description specifies that &quot;the presbyters&quot;, that is, the priests, are to do this:

Is any among you sick? Let him call for the elders [presbyters] of the Church and let them pray over him, anointing him with oil in the name of the Lord; and the prayer of faith will save the sick man, and the Lord will raise him up; and if he has committed sins, he will be forgiven.
James 5:14–15, NABRE; emphasis added

You don't mention the Sacrament of Holy Orders. This ordaining of priests is creating a man a delegate of his bishop. Thus only a bishop has this capacity. In much the same way, Confirmation can only be administered by the bishop; he is the direct successor of the apostles who received the Holy Spirit, and he alone has the capability of directly conferring this gift on others.
The remaining sacraments are Baptism and Matrimony. In an emergency, any human being (theoretically even an atheist!) has the capability of baptizing another. A deacon is given this permission even under ordinary circumstances, as part of his &quot;ministry of service&quot;.
Finally, in the sacrament of marriage, the spouses are the ministers of the sacrament to each other. The Church merely desires to have an ordained person there as a witness on behalf of the Church. Any ordained man, therefore, can witness to a marriage.