Legally he can, the chain of command starts with him and there is no dual launch system. That’s because they needed the president to be able to make a rapid decision in an emergency with only minutes to decide. However he doesn’t launch them himself, there is no button to press. The order would then go through his defense secretary and then the Joint Chiefs of Staff and then to the Commanders
"The NCA consists only of the President and the Secretary of Defense or their duly deputized alternates or successors. The chain of command runs from the President to the Secretary of Defense and through the Joint Chiefs of Staff to the Commanders of the Unified and Specified Commands.”
World-Wide Military Command and Control System, DoD Directive S-5100.30
So, in practice, a president who ordered a nuclear attack in peacetime has to be obeyed by many people. He might well face some kind of a mutinous action, refusal to follow his orders, moves to be declared unfit to govern etc.
So, no he can’t just do this. He’d need to argue a case with others around him. If not, surely they would mutiny. That’s always an option. No matter how many agreements you sign, nobody can make you do something that you can see clearly to be ethically and morally unsound. What does it matter if you lose your job in a situation like that? Anyway the chances are that it’s the president who would be more likely to end up out of a job after the dust settles.
Details here with cites and discussion: Debunking: A President Of The US Could Order A Nuclear Attack At A Moments Notice On A Whim