LogoLogo
  • Welcome to Release
  • Getting started
    • Quickstart
    • Create an account
    • Prepare to use Release
    • Create an application
      • Create custom application
      • Create from template
      • Servers vs runnables
    • Create an environment
  • Guides and examples
    • Domains and DNS
      • Manage domains
      • DNS and nameservers
        • Configure GoDaddy
        • Configure Cloudflare
        • Configure Namecheap
        • Other DNS hosts
      • Routing traffic
    • Example applications
      • Full stack voting app
      • Flask and RDS counter app
      • Static site with Gatsby
      • Golang with Postgres and Nginx
      • WordPress with MySQL
      • Spring and PostgreSQL
      • Terraform and Flask
      • OpenTelemetry demo
      • Load balancer with hostname
      • Static JavaScript service
      • SSH bastion access to services
      • ngrok and OAuth for private tunnels
      • Using OAuth Proxy
      • Hybrid Docker and static site
      • App Imports: Connecting two applications
      • Example library
    • Running instances
      • Cron jobs
      • Jobs
      • Using Helm charts
      • Using terminal
      • Viewing logs
      • Troubleshooting
        • ImagePullBackoff error
        • CrashLoopBackoff error
        • Exit codes
        • OOM: out of memory
    • Advanced guides
      • Containers guide
      • Application guide
      • Kubernetes guide
      • Create a cluster
      • Upgrade a cluster
      • Managing node groups
      • Patch node groups
      • Hostnames and rules
      • Serve traffic on multiple ports
      • Configure access to your K8s cluster
      • Designing for multiple environments
      • Microservices architecture
      • Monitoring your clusters
      • Performance tuning
      • Visibility and monitoring
      • Working with data
        • Container-based data
        • Seeding and migration
        • Cloud-provided data
        • Golden images
        • Third party
      • Pausing Instant Datasets
        • Application pausing schedules
        • Pause/resume environments
      • Infrastructure as code
        • Terraform
  • Reference documentation
    • Account settings
      • Account info
      • Managing users
      • Build settings
        • Build arguments
        • Build SSH keys
      • Add integrations
      • View clusters and cloud integrations
      • Add datasets
      • Environment handles
    • Workflows in Release
      • Stages of workflows
      • Serial deployments
      • Parallel deployments
      • Rolling deployments
      • Rainbow deployments
    • Networking
      • Network architecture (AWS)
      • Network architecture (GCP)
      • Ingresses
      • IP addresses
      • Cloud-provided services
      • Third-party services
    • Release environment versioning
    • Application settings
      • Application Template
        • Schema definition
      • Default environment variables
      • GitHub
      • Pull requests
      • GitOps
      • Just-in-time file mounts
      • Primary App Link
      • Create application FAQ
      • App-level build arguments
      • Parameters
      • Workspaces
    • End-to-end testing
    • Environment settings
      • Environment configuration
      • Environment variables
        • Environment variable mappings
        • Secrets vaults
        • Using Secrets with GitOps
        • Kubernetes Secrets as environment variables
        • Managing legacy Release Secrets
    • Environment expiration
    • Environment presets
    • Instant datasets on AWS
    • Instant datasets on GCP
    • Instant dataset tasks
      • Tonic Cloud
      • Tonic On-Premise
    • Cloud resources
    • Static service deployment
    • Helm
      • Getting started
      • Version-controlled Helm charts
      • Open-source charts
      • Building Docker images
      • Ingress and networking
      • Configuration
    • GitOps
    • The .release.yaml file
    • Docker Compose conversion support
    • Reference examples
      • Adding and removing services
      • Managing service resources
      • Adding database containers to the Application Template
      • Stock Off-The-Shelf Examples
    • Release API
      • Account Authentication
      • Environments API
        • Create
        • Get
        • Setup
        • Patch
      • User Authentication
      • Environment Presets API
        • Get Environment Preset List
        • Get Environment Preset
        • Put Environment Preset
  • Background concepts
    • How Release works
  • Frequently asked questions
    • Release FAQ
    • AWS FAQ
    • Docker FAQ
    • JavaScript FAQ
  • Integrations
    • Integrations overview
      • Artifactory integration
      • Cloud integrations (AWS)
        • AWS guides
        • Grant access to AWS resources
        • AWS how to increase EIP quota
        • Control your EKS fleet with systems manager
        • Managing STS access
        • AWS Permissions Boundaries
        • Private ECR Repositories
        • Using an Existing AWS VPC
        • Using an Existing EKS Cluster
      • Docker Hub integration
      • LaunchDarkly integration
      • Private registries
      • Slack integration
      • Cloud integrations (GCP)
        • GCP Permissions Boundary
      • Datadog Agent
      • Doppler Secrets Manager
      • AWS Secrets Management
    • Source control integrations
      • GitHub
        • Pull request comments
        • Pull request labels
        • GitHub deployments
        • GitHub statuses
        • Remove GitHub integration
      • Bitbucket
      • GitLab
    • Monitoring and logging add-ons
      • Datadog
      • New Relic
      • ELK (Elasticsearch, Logstash, and Kibana)
  • Release Delivery
    • Create new customer integration
    • Delivery guide
    • Release to customer account access controls
    • Delivery FAQs
  • Release Instant Datasets
    • Introduction
    • Quickstart
    • Security
      • AWS Instant Dataset security
    • FAQ
    • API
  • CLI
    • Getting started
    • Installation
    • Configuration
    • CLI usage example
    • Remote development environments
    • Command reference
      • release accounts
        • release accounts list
        • release accounts select
      • release ai
        • release ai chat
        • release ai config-delete
        • release ai config-init
        • release ai config-select
        • release ai config-upsert
      • release apps
        • release apps list
        • release apps select
      • release auth
        • release auth login
        • release auth logout
      • release builds
        • release builds create
      • release clusters
        • release clusters exec
        • release clusters kubeconfig
        • release clusters shell
      • release datasets
        • release datasets list
        • release datasets refresh
      • release deploys
        • release deploys create
        • release deploys list
      • release development
        • release development logs
        • release development start
      • release environments
        • release environments config-get
        • release environments config-set
        • release environments create
        • release environments delete
        • release environments get
        • release environments list
        • release environments vars-get
      • release gitops
        • release gitops init
        • release gitops validate
      • release instances
        • release instances exec
        • release instances logs
        • release instances terminal
  • Release.ai
    • Release.ai Introduction
    • Getting Started
    • Release.ai Templates
    • Template Configuration Basics
    • Using GPU Resources
    • Custom Workflows
    • Fine Tuning LlamaX
    • Serving Inference
Powered by GitBook
On this page
  • Create a Dockerfile
  • Isolated containers
  • Configurable containers
  • Docker Compose
  • Release Application Template and Environment Variables Template

Was this helpful?

  1. Guides and examples
  2. Advanced guides

Containers guide

PreviousAdvanced guidesNextApplication guide

Last updated 2 years ago

Was this helpful?

By now you should have a good understanding of which services (and repositories) are required to successfully model your services in Release. For each of these services, we recommend running through the following steps:

  • Create a Dockerfile to create a container.

  • Create a docker-compose to run the container.

OR

  • Create an Application Template file and an Environment Variables Template file in your repository.

Every application is different, so we cannot give you pre-canned files to use. However, in this guide we will walk you through using containers with Release at a high level.

Create a Dockerfile

In Release, services that are not static need to be run in containers. This means writing a , a set of instructions on how to build your service within a container. Here are some resources to help you write a Dockerfile:

For the best experience, your containers should be isolated and configurable.

Isolated containers

A container should contain everything it needs to run. This means that it should not be necessary to mount files from your local filesystem into the container to make it work. You need to be able to bring up a container with no reference to local files, so that everything required is built inside the container.

Configurable containers

In Release, you’ll use the same container image in multiple environments. For this reason, you need to be able to pass in configuration information, for example, the hostname of the generated database to use.

Environment variables

Traditionally, this configuration is done through environment variables, key value pairs set within a UNIX shell. An example of this might be:

DATABASE_HOST=<generated hostname>

Environment files

Release supports environment variables as the primary way to pass in configuration information. Some frameworks and systems will automatically look for and apply environment variables, but in some cases you may have to:

  1. Change your source code to look for environment variables and fall back to defaults if not found.

  2. Write an /entrypoint.sh wrapper script that runs whenever your container starts, which will write any required configuration files to the container and start your service.

Secrets

Secrets should never be checked into your source control (except in rare cases where you can encrypt them securely). Release offers a powerful way to input secrets into your Environment Variables Template, and this ensures that secrets are encrypted at rest and in flight during setup.

Alternatively, since Release runs in your own cloud provider account, you can also write code to integrate with your cloud-native services secrets manager, or use an open-source or managed service such as Vault.

Review

Sometimes your code needs to behave differently depending on where its running. For example, you may want to test your email sending functionality in your test environment, but not actually email all your users whenever you run tests. Your code might therefore need to be aware of its surroundings, and adapt at execution time. But there is no single set of rules for when or how your application needs to adapt to its environment.

One final tip: If you’re using an off-the-shelf framework such as Django, Rails, or Next.js, someone has already solved every problem you will ever encounter in Docker. You can google your way out of almost any common issue!

Docker Compose

Once you have a working Dockerfile, the next step is to build a docker-compose file. This is a built-in orchestration tool provided by Docker, and it allows you to model out multiple containers to be brought up in a specific order. A typical example would be a Django backend that requires Redis and Postgres to operate properly.

In our Django backend example, you would define the dependencies and provide the environment variables in your docker-compose.yaml file.

Here are some tutorials that will help you create a docker-compose file:

When you create an application with Release, we'll scan your Git repository for a docker-compose file and automatically model out the services it defines.

In the same way containers built from your Dockerfile must be isolated, your final docker-compose configuration must be completely self-contained and not require the mounting of files or import of anything external.

Release Application Template and Environment Variables Template

If you are an advanced user, or you are already familiar with Release, you can create or copy an Application Template and an Environment Variables Template into your repository and Release will automatically pull those files in during the scan process. If you have GitOps enabled, the whole process will be completely automated on every check-in of your codebase too. You can read more about in our documentation.

Dockerfile
Docker's Orientation and setup page
Get started with Docker Compose
Docker Tutorial: Get Going From Scratch
Define services in a Compose file
Getting started with Docker Compose
using GitOps with Release