Create composition

How to create environment configurations in Codefresh

Compositions can be launched as part of a unit test step, integration test step or for running an image for manual testing. You can create compositions from scratch or import an existing docker-compose.yml file.

1. Add a composition

From the left sidebar click on the Compositions menu. Then click the ADD COMPOSITION button.


2. Enter the name of composition

In the Composition Name text box, type a name for your composition and click NEXT.


3. Select Composition Starting Point

On this screen you can choose: What type of composition would you like to create?

Click NEXT for chosen way.


3.1 From file in repo

Start a new composition from a docker compose file in your repository.

  1. In the search box, type the name of the repository.


Can’t find your repository?

Try the ADD BY URL option.


  1. From the drop-down menu, select a branch for the first build.
  1. Click NEXT.
  1. Enter the path to docker-compose.yml By default, Codefresh searches for your docker-compose.yml at the root level of your repository, by the name docker-compose.yml. If your docker-compose.yml is in sub-directory, provide the path as well (./foo/bar/docker-compose.yml).


  1. Click NEXT.

We don’t support the build property of Docker compose. We will replace it with images automatically by a pipeline that is automatically created.


  1. Click CREATE.

Composition list

Your composition is now ready and should appear in the Compositions list.

3.2 From template

If your repository doesn’t include a docker-compose.yml file, you can use one of our templates to see how it works!

  1. Choose the template.
  1. Click CREATE.


You will see the Composition editor where you can change something and then launch this composition to see results.


Click on the rocket icon to launch this composition.

3.3 Empty composition

If you chose the Empty composition you can now create a composition from scratch. You will see the following screen with an empty composition.

  1. To add a service, click the Add Service button. You can add existing built services, or provide the name for Docker image that will be pulled from Docker registry.
  1. (Optional) Click the Edit button to edit the content based on Docker Compose YAML .


  1. Click the Save icon on the upper right corner.

Working with existing compositions

You can edit each composition you created (regardless of the original creation method) by clicking on its name from the compositions list. You will see a yaml editor that allows you to edit the details of the composition.


Manually launching compositions

Once you are ready click the small “rocket” button to launch your composition. This will create a temporary test environment in your Codefresh account that you can use to inspect your application.

  1. From the left sidebar click on the Compositions menu. Then select a composition.

Composition list

  1. Click the Launch icon button.


click on image to enlarge
  1. Review the log to verify that the launch completed successfully.


Sharing the environment URL

After you successfully spin up a composition, click the Running compositions tab from the Compositions item in the left pane, to view a record for the running environment and all containers for the environment.

Active test environments

Active test environments

Click the Hashtag icon to share your environment with your team.

Sharing environment link

Sharing environment link