How can I stop Ubuntu Dock from extending to the edges?

Solution 1:

Open Terminal and run

gsettings set org.gnome.shell.extensions.dash-to-dock extend-height false

To revert to the "panel mode" run

gsettings set org.gnome.shell.extensions.dash-to-dock extend-height true

Solution 2:

Using either the Gnome Tweak Tool, or https://extensions.gnome.org/local/, disable the 17.10 built-in Ubuntu Dock extension, and install the more configurable Dash to Dock extension, and it'll give you the shorter dock you desire.

https://extensions.gnome.org/extension/307/dash-to-dock/