Howto run a Terminal command using shortcut or a button
There are multiple ways to do this, here are 2.
First method: Create a quick script that runs after a double-click.
Create a text file, named myScript.command. The '.command' postfix will let Finder know to run it on opening.
Add the following as plain text:
#!/bin/bash
killall -KILL Dock

Now the script exists but needs to be executable. To do this you need to do a chmod.
chmod 755 myScript.command 

Running myScript.command will open a Terminal window and run the command. The first line, hashbang, will let your computer know to use bash for the following script. You can set the preferences in Terminal.app to close the terminal window after a clean exit.
Second method: Create a 'Service' and bind a keystroke to that service.
Create and install the service:

Open Automator
New Document -&gt; Service
Add the 'Run Shell Script' module and insert your code killall -KILL Dock
Set the 'Service receives no input', save and quit.
Install your newly created service by opening it in Finder and choose 'Install'.

Attach a keystroke to this service:

Open 'System preferences' -&gt; 'Keyboard' -&gt; 'Keyboard shortcuts' -&gt; 'Services'
Find the 'Kill Dock' service and attach a keystroke to it.