drone-docker icon indicating copy to clipboard operation
drone-docker copied to clipboard

Allow configuring image name (`-t`) in initial build command

Open Hoishin opened this issue 5 years ago • 5 comments

Currently the initial docker build command passes -t option with commit hash and cannot be configured. If a repo has multiple dockerfiles and the both are built at the same time, it conflicts the tag name and results in error.

Hoishin avatar Oct 31 '19 09:10 Hoishin

That's not true, this plugin is using docker in docker, which isolates the builds.

If you are using the plugin differently it's simply a corner case which is not covered by the intended use case.

tboerger avatar Oct 31 '19 13:10 tboerger

Mind showing what's the intended way to use it? I'm current setting

volume:
  - /var/run/docker.sock:/var/run/docker.sock

so it shares the docker runtime with the host OS. and I though this was intendend way to use DinD.

Hoishin avatar Oct 31 '19 14:10 Hoishin

That's not dind at all. Just remove the volume, than it will properly build and it's working as intended.

tboerger avatar Oct 31 '19 15:10 tboerger

I ran into this problem too - I am mounting the host docker volume because our image is a heavy build and without it, the plugin will not have an image cache and end up building images every single time. Is there a way to configure that?

urjitbhatia avatar Oct 30 '20 19:10 urjitbhatia

I stumbled on this too. We have drone pipeline building set of images to ECR repo (using drone-ecr). To test that pipeline locally, I replace the steps with drone-docker and set daemon_off: true, dry_run: true and mount the socket. This works, except the images are build concurrently and all of them use the image name 00000000, which of course is not unique.

Just using the format <repo>:<commit-sha> should be enough to fix the issue.

raphendyr avatar Jul 30 '21 11:07 raphendyr