Every enlisted member of the military in the US takes an oath to obey the orders of the president of the united states. (Every officer has a slightly different oath that refers the constitution, rather than the POTUS)
The Uniform Code of Military Justice, however, is a bit more specific. Article 92 of the UCMJ states:
Any person subject to this chapter who
(1) violates or fails to obey any lawful general order or regulation;...shall be punished as a court-martial may direct.
Note the key word lawful. This has been interpreted to mean that any unlawful order does not necessarily need to be obeyed within the military.
In fact, obeying an unlawful order can be punishable.
So that leaves the question when is it lawful for the President to order a nuclear strike?
As I am not a scholar on this topic, I'll do my best here to understand what the president can and can not do.
For starters, the command to launch a nuclear weapon requires 2 people approving. One being the president, the second being the Secretary of Defense:
The United States has a two-man rule in place, and while only the president can order the release of nuclear weapons, the order must be confirmed by the Secretary of Defense
If the SoD disagrees with the president, the president has the right to relieve them of duty, and ask the person next in line to take the position and approve the command.
However, the VP among others have the right to enact Section 4 of the 25th Amendment and have the President declared disabled.
In addition to the above, there appears to be some other protocols in place that make it not as simple as just pushing a button. Alas, I can't find any conclusive sources for these (so other's, please refute or confirm these)
- While it appears the 2-man rule is in place to actually launch the codes, the president must also notify many other parties in government that it is happening
- The military may want to see signs of imminent threat before deciding the order is warranted and lawful
- In addition to US law, there are also international treaties that may restrict how and when nuclear weapons can or can not be used.
To answer the question: No, it appears that the president cannot uni-laterally launch nuclear weapons.