D365 Business Central : Duplicate BC Container
I recently have an issue where I need to spin up a new D365BC docker container for the same project. Because I already have some data in my current container, I want to duplicate my existing container (instead of creating a clean new one).
I couldn’t find a direct command to duplicate a container, so I need to create a new image first from the existing container using commit. Using that image, I can spin up a new docker container.
docker commit container_id new_image
You can find your container id by using:
docker container ls
Run the docker commit command. You need to make sure the container is not running first. Otherwise you will get below warning.
docker commit 98faebb7176d bc20clone
Depending on the container size, it will take a few minutes to have the new image. After that, you can just use your new image in New-BcContainer -imageName parameter.