Everything is a Docker image

Everything is a Docker image

2 min read

Ultimately Codefresh is a DevOps platform designed for containers and Kubernetes. The backbone of all of that is the Codefresh pipelines which provide Docker in Docker as a service. This has a lot of implications for how you build pipelines, support multiple languages and handle tooling.

Updated information: If you want to build and run Docker images in our pipeline see our dedicated guides and examples

Each step runs in it’s own container

When defining a custom step in Codefresh, you start by specifying which image you want to run. For example, what if we wanted to curl Slack to post a message?

slack_notify:
  image: tutum/curl
  commands:
    - curl -X POST --data-urlencode 'payload={"text":"Test slack integration via yaml"}' ${{SLACK_WEB_URL}}

This will take the curl image, load it into a fresh container and execute the command. That means that basically any Docker image is a direct plugin for the Codefresh pipeline.

You can spin up an entire composition

Going beyond just running an image, you can actually use the DinD service to spin up an instance of several images at once. For example, in this example, we spin up a demo application with Taurus, the performance testing suite to run tests against Blazemeter.

RunningPerformanceTests:
    title: Running Performance Tests
    type: composition
    composition:
      version: '2'
      services:
        aut:
          ports:
            - 5000
          image: 'containers101/demochat:master'
        mongo:
          image: mongo
    composition_candidates:
      cfintegration:
        image: 'r.cfcr.io/razielt77_github/razielt/taurus:master'
        environment:
          - CF_VOLUME_PATH=${{CF_VOLUME_PATH}}
          - TOKEN=${{TOKEN}}
          - TR_SCRIPT=${{TR_SCRIPT}} 
        volumes:
         - '${{CF_VOLUME_NAME}}:/codefresh/volume'
    add_flow_volume_to_composition: true

Keeping a persistent Volume

Each step in the pipeline is using it’s own container but we’re maintaining a persistent volume. This allows you to pass information between steps, utilize caching, etc. In this example, we’ll add JIRA information from a Codefresh pipeline.

Conclusion

To get started, create a free account, or checkout our documentation.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment

Build your GitOps skills and credibility today with a GitOps Certification.

Get GitOps Certified

Ready to Get Started?
  • safer deployments
  • More frequent deployments
  • resilient deployments