# Slicer template based build environment using docker

**URL:** <https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398>\
**Category:** Development\
**Tags:** build, docker\
**Created:** [October 28, 2021, 6:03am UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398 "2021-10-28T06:03:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [October 28, 2021, 6:03am UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/1 "2021-10-28T06:03:47Z")

</div>

Hi,

I am very new in Docker build environment setup can you please explain me how to setup and use docker baed environment.

I have gone through [GitHub - Slicer/SlicerBuildEnvironment: A repository of scripts to set up a Slicer build environment.](https://github.com/Slicer/SlicerBuildEnvironment) but not getting how to setup for slicer custom templet.

Is there any way to do cmake and make using docker.  
or any other best way to build a code.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [October 29, 2021, 3:49am UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/2 "2021-10-29T03:49:45Z")

</div>

Could you tell a bit more about what you would like to achieve? Build Slicer? Build extensions and to avoid building Slicer? Run Slicer?

---

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [November 8, 2021, 12:20pm UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/3 "2021-11-08T12:20:11Z")

</div>

I am building custom slicer from templet provided by [slicer cat](https://blog.kitware.com/slicercat-creating-custom-applications-based-on-3d-slicer/)

I have gone through [https://github.com/Slicer/SlicerBuildEnvironment](https://github.com/Slicer/SlicerBuildEnvironment) and able to build it but getting issue in how to execute the executable I am using "qt5-centos7 to use GCC 7 " based docker image.

I want to make run the executable in Windows 10.

But not getting how to achieve.

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 8, 2021, 7:16pm UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/4 "2021-11-08T19:16:50Z")

</div>

The SlicerBuildEnvironment docker image is for testing the build. We have separate dockerfiles for running Slicer, which typically install a precompiled release in the image and set up a vnc server so that you can see the GUI of the application running in the container. Probably you can combine the two kinds of images.

However, to better reproduce the end-user experience, it is probably better to build Slicer using the [standard build instructions](https://slicer.readthedocs.io/en/latest/developer_guide/build_instructions/index.html) and test it by running directly, natively on a physical machine.

---

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [November 9, 2021, 10:52am UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/5 "2021-11-09T10:52:26Z")

</div>

Thank you very much sir.

we are using standard build environment but facing issue while replicating build environment in multiple local system, however we are keeping same tool versions.  
Any solution for this?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 9, 2021, 12:54pm UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/6 "2021-11-09T12:54:18Z")

</div>

What operating systems are causing trouble? What problems do you have when replicating the build environment: build fails on some systems or the generated binaries are not compatible with each other?

---

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [November 10, 2021, 6:37am UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/7 "2021-11-10T06:37:44Z")

</div>

**We are using following configuration for the development.**

Operating system: Windows 10  
CMAKE: 3.18.2  
NSIS: 3.08  
QT: 5.15.0  
Visual Studio community 2019

Error and warnings are attached

 ![error](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/7/a/7a9e990ca7678a2a8e8d38bc222619c3169fe52e.png)  
 ![warnings](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/5/6/565992d2090b093d6edbe5a04e0f3095e8df29f2.png)

reference for the 1st error is

 ![e1](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/8/e8aaf6bdcde2bd26daedcbef19920a974bca52fe.png)

reference for the 2nd error is

 ![e2](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/b/3/b302f0a4e2c43b12f708d76d58ad5ecf32d39d73.png)

reference for the 3rd,4th and 5th error is

 ![e345](https://us1.discourse-cdn.com/flex002/uploads/slicer/original/3X/e/b/ebccca3ae32c5d47db662c5d9bace336d1d398be.png)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 10, 2021, 1:56pm UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/8 "2021-11-10T13:56:55Z")

</div>

Is this the latest version on Slicer master branch of [GitHub - Slicer/Slicer: Multi-platform, free open source software for visualization and image computing.](https://github.com/Slicer/Slicer)?  
Have you built from scratch or you have previously built an earlier version of the source code in the same build tree?

---

<div class="post-metadata">

**Author:** ![Dwij\_Mistry](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/dwij_mistry/32/15265_2.png) [@Dwij\_Mistry](https://discourse.slicer.org/u/Dwij_Mistry)\
**Post date:** [November 11, 2021, 4:29am UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/9 "2021-11-11T04:29:12Z")

</div>

No, First build is from [custom SliceCAT templet by Kitware](https://blog.kitware.com/slicercat-creating-custom-applications-based-on-3d-slicer/) ,

First build system configuration is  
**EDDITION:** Windows Server 2016 Standard Evaluation  
**VERSION:** 1607  
**OS BUILD:** 14393.4651

I would like to give you brief introduction regards our development.  
First we started building on above mentioned system.  
which we are still using.

Now we are expanding the development team, and providing local personal system with following Operating system configurations.  
**EDDITION:** Windows 10 Home Single Language  
**VERSION:** 20H2  
**OS BUILD:** 19042.1288

and how we are building is First we are taking our custom templet and building it, which is successfully building then we are replacing **slicersource-src** folder with our latest developed code. then we are building and getting errors as mentioned in previous answer.

moreover is there any way to implement GITHUB in our development?

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [November 11, 2021, 5:40am UTC](https://discourse.slicer.org/t/slicer-template-based-build-environment-using-docker/20398/10 "2021-11-11T05:40:18Z")

</div>

> [@Dwij\_Mistry](#):
>
> and how we are building is First we are taking our custom templet and building it, which is successfully building then we are replacing **slicersource-src** folder with our latest developed code.

This can certainly lead to build errors. For performance reasons, not all dependencies are rebuilt when you just change the Slicer source folder, which may result in trying to build a new Slicer with an older CTK version. You can fix this by rebuilding CTK manually - opening the (slicer-build)\CTK-build\CTK.sln project in Visual Studio and build it in the appropriate build mode. But the clean solution is to update the template to pull Slicer source from your repository and then do a clean build.

I don’t think that’s the issue here, but Windows Server works quite differently from a regular Windows version. If you can, use non-server Windows edition.
