buildkit: Layer in built image is missing / empty 0B

Since upgradeing to v0.8.1 from v0.8.0, I encounter a missing layer, or at least a missing file in the built image. When trying to start the image, it fails, because the entrypoint file is missing. I can confirm this, if I override the entrypoint and start the image, the docker-entrypoint.sh isn’t there. I could reproduce this for multiple builds in CI, after downgrading, the bug was gone.

My Dockerfile has this structure:


# Install php dependencies
FROM composer:1 AS php-dependencies

COPY composer.lock composer.json ./
RUN composer install --ignore-platform-reqs


FROM php:7.4-cli AS base

WORKDIR /application

# ... some stuff

# Configure entrypoint script
COPY dockerfiles/php/docker-entrypoint.cron.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]


FROM base AS production

# Copy built dependencies and src
COPY --chown=33:33 . .
COPY --from=php-dependencies --chown=33:33 /app/vendor ./vendor

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 26 (9 by maintainers)

Commits related to this issue

Most upvoted comments

I finally got the commit! Building from dda009a58c76e3e54b4539dce23623eefcc4428c breaks the image after first cache import, 48991bf6c4f9d39f30a7795ede75871f86a4d06b does not. So it would be fixed in 0.8.2, if v1.EmptyLayerRemovalSupported was false by default.

As I already outlined above, our dockerfile contains:

# Configure entrypoint script
COPY dockerfiles/php/docker-entrypoint.cron.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh

So would the RUN layer be removed/is this layer „empty”?