Get all gallery images

I’m trying to pull through the gallery images on the product page because customizing the gallery with code:

<?php $  _product = $  block->getProduct(); ?> <?php $  gallery = $  _product->getMediaGalleryImages(); ?>  <?php foreach ($  gallery as $  galleries): ?>   <figure><?php echo $  galleries ?></figure> <?php endforeach; ?> 

But first image is not loading. How fix this?