Whilst booted into macOS, you can easily use Disk Utility which comes with macOS to do this. Simply open Disk Utility from your Utilities folder in your Applications folder, choose the source drive from the left hand pane, then click on new image. Expand the file name box and choose a file name for your image, and make sure you select your new drive as the location to store the disk image. In theory, as long as you select the root drive, and not a partition, the image should contain all of your partitions which can then be mounted (as long as you are using a file system macOS supports) and read as well as restored to another drive.
Additionally, if you want to duplicate your SSD to another drive (erasing the other drive in the process) you can choose the destination drive from the left hand pane, and then click the Restore tab. Drag your SSD from the left into the text field which is labelled Source, and drag your destination drive from the left into the box that says Destination.