The Solution

Go to Appearance> Editor and click on style.css on the lower right side. Scroll down a bit until you see:

.wp-caption{padding: 10px; width: auto !important; background: url(images/layout/transparent-bg.png) repeat;

Delete the width:auto !important; part.

Save your changes and then click on custom.css. Add this to keep your images centered inside the caption box:

.wp-caption img {

margin: 0 auto;

}

Elementor