My Dock won't launch upon login
Sometimes the LaunchAgent (launchd job) that ensures that the Dock starts up gets stuck. Try unloading and re-loading it:

launchctl unload -F /System/Library/LaunchAgents/com.apple.Dock.plist
launchctl   load -F /System/Library/LaunchAgents/com.apple.Dock.plist
launchctl start com.apple.Dock.agent


The Dock is an app, and apps run as the current user, not as root. (To convince yourself that this is true, remember that each user has their own Dock.) So don't start it with sudo, unless you want to see the root user's Dock. You should be able to start it the way you did (except without sudo), given that the LaunchAgent is unloaded:

launchctl unload -F /System/Library/LaunchAgents/com.apple.Dock.plist
/System/Library/CoreServices/Dock.app/Contents/MacOS/Dock


The reason you need to unload the LaunchAgent is because it will reserve certain ports/services for use by the Dock process it's (unsuccessfully) trying to launch. This keeps your manually-launched Dock process from using them.