Use local docker images in agent (switch from v0.8 to v1rc5)

I used drone v0.8 so far and my workflow has been to manually build the docker image on the machine the agent is running. Having the correct name of the image I write the pipeline like

pipeline:
    test:
        image: a-custom-image-name
        commands:
          - echo "hello world"

And it worked fine so far. However, testing the drone1rc5-agent+server gives me

Error response from daemon: pull access denied for , repository does not exist or may require ‘docker login’

The new agent runs on the exact same machine like the old one. A workaround would be to push all docker image to docker-hub (I tested that way).

But is this the only way the new version from now supports: only a registry somewhere?

My docker-compose file looks like

version: '2'

services:
  drone-server:
    image: drone/drone:1.0.0-rc.5
    ports:
      - 3007:80
    volumes:
      - /var/lib/drone1:/data
      - /var/run/docker.sock:/var/run/docker.sock
    restart: always
    environment:
      - DRONE_OPEN=true
      - DRONE_ORGS=<orgname>
      - DRONE_ADMIN=<username>
      - DRONE_SERVER_HOST=ci.example.com
      - DRONE_SERVER_PROTO=https
      - DRONE_GITHUB=true
      - DRONE_USER_CREATE=username:<username>,admin:true
      - DRONE_GITHUB_SERVER=https://github.com
      - DRONE_GITHUB_CLIENT_ID=<client-id>
      - DRONE_GITHUB_CLIENT_SECRET=<cient-secret>
      - DRONE_RPC_SECRET=<rpc-secret>
      - DRONE_TLS_AUTOCERT=false

  drone-agent:
    image: drone/agent:1.0.0-rc.5
    command: agent
    restart: always
    links:
      - drone-server
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_RPC_SERVER=https://ci.example.com
      - DRONE_RPC_SECRET=<rpc-secret>
      - DRONE_RUNNER_CAPACITY=2
      - DRONE_RUNNER_NAME=default

I haven’t used a private docker registry beforehand. The question remains if drone v1 would need such a registry or can have a fallback to already existing docker images. (There are no typos, I use the exact same .drone.yml file)

Drone automatically pulls the :latest version of an image. You can prevent this behavior by adding pull: never to a 1.0 yaml configuration file.

kind: pipeline
name: default

steps:
- name: test
  image: a-custom-image-name
  pull: never
  commands:
  - echo "hello world"

Thanks for the hint.

I tried to switch back to a local docker image:

The response from drone is

{"message":"yaml: unmarshal errors:\n  line 2: cannot unmarshal !!str `never` into bool"}

after switching to pull: false. I still get the same issue of

Error response from daemon: pull access denied for cppnumericalsolver_dynamic, repository does not exist or may require ‘docker login’

. The output (drone v1rc5) is here:

https://ci.patwie.com/PatWie/CppNumericalSolvers/2/1/2

  • The output (drone v0.8) is here (from a previous commit but same config):

https://ci2.patwie.com/PatWie/CppNumericalSolvers/16/3

But on the machine the command

sudo docker run -i -t cppnumericalsolver_dynamic bash

works. I supsect this being a bug or a side effect of using the old yaml-config and not the new one?!

You cannot use pull: never with the 0.8 yaml syntax. You must use the 1.0 yaml syntax, which I used in the sample I provided in my previous comment. You can learn more about this syntax at docs.drone.io.

also, note that you do not need to use an agent if you are running everything on the same machine. You can follow the single-machine installation instructions in the docs, which only require running a single container.

This does the trick! Thank you! I will port all .drone.yml files to the new format. I also enjoy the jsonnet configuration idea.