More Docker. Easy Access. New Streamlined Plans. Learn more.

Generic environment integration with CLI

Table of contents

You can create a generic environment integration by running the Docker Scout CLI client in your CI workflows. The CLI client is available as a binary on GitHub and as a container image on Docker Hub. Use the client to invoke the docker scout environment command to assign your images to environments.

For more information about how to use the docker scout environment command, refer to the CLI reference.

Examples

Before you start, set the following environment variables in your CI system:

  • DOCKER_SCOUT_HUB_USER: your Docker Hub username
  • DOCKER_SCOUT_HUB_PASSWORD: your Docker Hub personal access token

Make sure the variables are accessible to your project.


version: 2.1

jobs:
  record_environment:
    machine:
      image: ubuntu-2204:current
    image: namespace/repo
    steps:
      - run: |
          if [[ -z "$CIRCLE_TAG" ]]; then
            tag="$CIRCLE_TAG"
            echo "Running tag '$CIRCLE_TAG'"
          else
            tag="$CIRCLE_BRANCH"
            echo "Running on branch '$CI_COMMIT_BRANCH'"
          fi    
          echo "tag = $tag"
      - run: docker run -it \
          -e DOCKER_SCOUT_HUB_USER=$DOCKER_SCOUT_HUB_USER \
          -e DOCKER_SCOUT_HUB_PASSWORD=$DOCKER_SCOUT_HUB_PASSWORD \
          docker/scout-cli:1.0.2 environment \
          --org "MY_DOCKER_ORG" \
          "ENVIRONMENT" ${image}:${tag}