---
title: "Create an environment (scripting)"
url: "https://help.dectris.cloud/en/article/create-an-environment-scripting"
language: "en"
last_updated: "2025-08-05T13:13:03.577Z"
---

# Create an environment (scripting)

How to create a new custom environment from a Docker build script

## Step-by-step tutorial

1.  Navigate to the creation page via **Analysis** → **Environments** → **Create Environment**
2.  Enter environment details such as title, description, and intended scientific technique:![](https://cdn-assets.productfruits.com/34ba0daa-e377-4e45-964a-9290fdc29674)
3.  On the next page, click **CREATE SCRIPT**:![](https://cdn-assets.productfruits.com/e3e3431c-fa6c-4e25-933e-3db11dac864c)
4.  Write (or copy-paste) a Docker build script into the editor, keeping the following in mind:![](https://cdn-assets.productfruits.com/062a5d26-b870-4147-ada3-e72151e28003)
    1.  Currently, only ubuntu:22.04 and ubuntu:24.04 are available as a base image
    2.  If you upload a supporting file, `script.sh`, you can copy the file into the container from the `./script.sh` location
    3.  Note that the `ENV` command will set an environment variable while the environment is created, but it will not be set in a [session](https://help.dectris.cloud/en/article/sessions) started with this environment. E.g., to `/your/dir` on `PATH`, it is recommended to use both 
        -   `ENV PATH=$PATH:/your/dir` and
        -   `RUN echo 'export PATH=$PATH:/your/dir' >> /etc/profile`
    4.  Do NOT add any files to `/app` or `/work` as those directories will not be accessible when running a job.
5.  On the next page, review your environment configuration and click **START BUILD:![](https://cdn-assets.productfruits.com/35df3f51-bdcc-4913-b9ed-f7c0f695f3a7)**
6.  On the build confirmation page, you can either wait for the environment build to finish to review the build output:![](https://cdn-assets.productfruits.com/3a1dc4c4-a5c7-42d6-a26f-5c2a6e2ca64a)or you can navigate to the environments overview table at **Environments** → **Environments**, choose your newly created environment, and review the build output from there:      ![](https://cdn-assets.productfruits.com/c3f745cd-918f-44b2-bbcb-1212fb185659)
7.  Environments can be used personally for starting sessions with specific configurations and/or launching jobs. They can also be shared with collaborators. Before sharing an environment, make sure you have the rights to redistribute any software within it. 

## CloudPlay

[Embedded content](https://www.youtube.com/embed/YoMHTRJIlJ0)

## References

\[1\] https://xds.mr.mpg.de/

\[2\] https://github.com/dectris/neggia
