crate / docker-crate

Source repository for the official CrateDB Docker image
https://registry.hub.docker.com/_/crate/
Apache License 2.0
49 stars 22 forks source link

Move consecutive COPY commands to avoid Docker bug #152

Closed autophagy closed 5 years ago

autophagy commented 5 years ago

Summary of the changes / Why this is an improvement

There seems to be a bug in docker affecting Jenkins' ability (as well as my own, locally) to build docker images with 3 consecutive COPY/ADD commands. Previously, this would result in:

 ---> d21806a43c11
Step 17/21 : COPY --chown=1000:0 config/crate.yml /crate/config/crate.yml
 ---> d3ce15d62c5f
Step 18/21 : COPY --chown=1000:0 config/log4j2.properties /crate/config/log4j2.properties
 ---> 3e09f7cc5247
Step 19/21 : COPY docker-entrypoint.sh /
failed to export image: failed to create image: failed to get layer sha256:da5198c8160f19dfcd3a574a0ca58243c26e40f9eeacba76a5f5428a41cd7616: layer does not exist

Running the docker build a second time would pass successfuly. This has been reported in multiple places:

https://github.com/moby/moby/issues/37965#issuecomment-448926448 https://github.com/moby/moby/issues/38866

Moving 2 copy commands before the label and keeping the docker entrypoint addition afterwards circumvents this issue.

A little ugly, but until it is fixed in Docker, we can't build/deploy our CrateDB images on Jenkins.

Checklist

autophagy commented 5 years ago

Good idea. Will add it, and merge.