0

Have to use a private Image from aws or gcp for my build process in drone.

The simplest DOCKERFILE example:

FROM ***.dkr.ecr.eu-central-1.amazonaws.com/***:latest

That means i have to login, which works fine. My drone.yml example:

steps:
  - name: docker
    privileged: true
    image: revenuehack/drone-ecr-auth
    environment:
      AWS_ACCESS_KEY_ID:
        from_secret: aws_access_id
      AWS_SECRET_ACCESS_KEY:
        from_secret: aws_key
      AWS_REGION: eu-central-1
    commands:
      - aws ecr get-login --region $AWS_REGION --no-include-email | sh

But now i have to pull the image and use it in different steps of the ci process. Other questions suggest binding the docker.sock like here. Does not feel right to me. Id rather have some sort of service for that. Is that possible? Also this binding does not work:

    volumes:
      - /var/run/docker.sock:/var/run/docker.sock)
2
  • Do I understand correctly that you want to build and push an image to your private registry, and then use the private image in next step? Aug 29, 2019 at 20:43
  • yes exactly. my workaround at the moment is: 1. to push it to ecr through plugins/ecr 2. pull it with image: ***.dkr.ecr.eu-central-1.amazonaws.com/test i would like to do it without pushing it in the middle Sep 2, 2019 at 12:55

1 Answer 1

0

Option 1: Global Registry

Personally I would suggest using the drone-registry-plugin, works great to keep access to the ECR repos live:

Now, a caveat to this suggestion, is that it mimics the v0.8 global registries function, so all pipelines maintained in the installation would have ability to access the registry.

Option 2: Local docker config.json

Since this could technically be run by anyone also, I'm not sure what you gain over the registry plugin, but here is the ref:

This option involves placing a .docker/config.json onto the agents using cloud-init or some other mechanism and then in the individual pipelines you would then be able to add another root level yaml block image_pull_secrets:

kind: pipeline
name: default

steps:
- name: someStep
  image: some.registry.dev/some-image:latest

image_pull_secrets:
- dockerconfigjson

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.