Reference Navigation Down arrow

VM DASHBOARD

DOCKER
ACCOUNTS
USERS
APPLICATIONS
JOBS
ENVIRONMENTS
RELEASES
DEPLOYMENTS
BUILDS
SERVERS
WORKFLOWS
APP GROUPS
INTEGRATIONS
NOTIFICATIONS
GROUPS
PIPELINES
DASHBOARDS

Docker with distelli-manifest.yml


Enabling Docker with new applications in Distelli will automate the generation of the Docker commands in your manifest, while you use the WebUI Distelli manifest.

If instead you are using the distelli-manifest.yml you will need to supply the appropriate commands in your distelli-manifest.yml file. This document details those commands.

You will still need to configure your application, in Distelli, to integrate with Docker for these commands to work correctly. See:

When you integrate your application in Distelli with a Docker container registry and repository, Distelli populates environment variables during build and deploy to inject the appropriate values.

The syntax for the commands in your manifest to use these environment variables is the same whether you are using Docker Hub or AWS ECR.

Build

During a Distelli build with Docker the following steps must occur.

  1. Build the application first.
  2. You will first want to build and test your application. If this is successful, then, and only then, proceed to build the Docker image.

  3. Login to the Docker container registry.
  4. Using the credentials supplied, login to the Docker container registry so that when the image is ready it can be pushed.

  5. Build the Docker Image.
  6. Using a supplied Dockerfile, build the Docker image. For more info see Docker Dockerfile.

  7. Tag the Docker Image.
  8. Distelli tags the image with a unique incrementing value, the build number.

  9. Push the Docker Image to the container registry.
  10. The final step pushes the completed tagged image up to the container registry.

The above steps can be accomplished with the following syntax/commands in the distelli-manifest.yml Build: section.

  Build:
    ### Application build commands should be first ###
    ###
    ### Docker Build Commands ###
    - docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" $DISTELLI_DOCKER_ENDPOINT
    - docker build --quiet=false -t "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_PATH"
    - docker tag "$DISTELLI_DOCKER_REPO" "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM"
    - docker push "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM"
    ### End Docker Build Commands ###

Deploy

During a Distelli deploy with Docker the following steps must occur.

The following assumes that Docker is installed on the server being deployed to.

  1. Login to the Docker container registry.
  2. Using the credentials supplied, login to the Docker container registry so the image can be pulled.

  3. * Pull the Docker image.
  4. * The pull is not required as doing a run will initiate a pull if necessary.

  5. Run the Docker image as a container.
  6. Finally run the Docker container. * Pull is not required as a run will initiate a pull if necessary.

The above steps must be entered in 2 different manifest sections. In the below example, the login is included in the PreInstall section. The docker run command must occur in the Exec: section.

  PreInstall:
    ### Docker Pre Install Commands ###
    - sudo docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" $DISTELLI_DOCKER_ENDPOINT
    ### End Docker Pre Install Commands ###
  Exec:
    ### Docker Exec Commands ###
    - cid=$(uuidgen)
    - trap 'sudo docker stop $cid' SIGTERM
    - sudo -E docker run --name=$cid $DISTELLI_DOCKER_ENVS --rm=true $DISTELLI_DOCKER_PORTS  "$DISTELLI_DOCKER_REPO:$DISTELLI_BUILDNUM" &
    - wait
    - "true"
    ### End Docker Exec Commands ###

After you have completed the above steps you can build and deploy Docker with Distelli.

Next Steps

Product Documentation

Product Documentation Index