Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel build issue #13

Open
Lapshin opened this issue Nov 16, 2021 · 0 comments
Open

Parallel build issue #13

Lapshin opened this issue Nov 16, 2021 · 0 comments

Comments

@Lapshin
Copy link

Lapshin commented Nov 16, 2021

Hi there,

I found if build multiple images in parallel with docker-plus, it runs into an issue - images built incorrectly. A simple example:

Directories:

- image1
  - Dockerfile
- image2
  - Dockerfile

image1/Dockerfile

# syntax = edrevo/dockerfile-plus
FROM debian:jessie

ARG MY_ARG=1111
RUN sleep 5
RUN echo 111 $MY_ARG

image2/Dockerfile

# syntax = edrevo/dockerfile-plus
FROM debian:jessie

ARG MY_ARG=2222
RUN sleep 5
RUN echo 222 $MY_ARG

Now execute 2 terminals and simultaneously run:

DOCKER_BUILDKIT=1 docker build  -t image1 . -f image1/Dockerfile
DOCKER_BUILDKIT=1 docker build  -t image2 . -f image2/Dockerfile

The logs from terminals:
image1

alex@alex-p15s:~/git/esp-dockerfiles$ DOCKER_BUILDKIT=1 docker build  -t image1 . -f image1/Dockerfile
[+] Building 0.4s (10/10) FINISHED                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 146B                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => resolve image config for docker.io/edrevo/dockerfile-plus:latest                                                                                                                                  0.1s
 => CACHED docker-image://docker.io/edrevo/dockerfile-plus@sha256:d234bd015db8acef1e628e012ea8815f6bf5ece61c7bf87d741c466919dd4e66                                                                    0.0s
 => local://dockerfile                                                                                                                                                                                0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/debian:jessie                                                                                                                                      0.0s
 => [1/3] FROM docker.io/library/debian:jessie                                                                                                                                                        0.0s
 => CACHED [2/3] RUN sleep 5                                                                                                                                                                          0.0s
 => CACHED [3/3] RUN echo 222 2222                                                                                                                                                                    0.0s
 => exporting to image                                                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                                                               0.0s
 => => writing image sha256:77bd3f97932e3a7f47e97658da199c35624f1ee156b93d61d84c4fcde1fdf7f9                                                                                                          0.0s
 => => naming to docker.io/library/image1

image2

alex@alex-p15s:~/git/esp-dockerfiles$ DOCKER_BUILDKIT=1 docker build  -t image2 . -f image2/Dockerfile 
[+] Building 0.9s (10/10) FINISHED                                                                                                                                                                         
 => [internal] load build definition from Dockerfile                                                                                                                                                  0.0s
 => => transferring dockerfile: 146B                                                                                                                                                                  0.0s
 => [internal] load .dockerignore                                                                                                                                                                     0.0s
 => => transferring context: 2B                                                                                                                                                                       0.0s
 => resolve image config for docker.io/edrevo/dockerfile-plus:latest                                                                                                                                  0.6s
 => CACHED docker-image://docker.io/edrevo/dockerfile-plus@sha256:d234bd015db8acef1e628e012ea8815f6bf5ece61c7bf87d741c466919dd4e66                                                                    0.0s
 => local://dockerfile                                                                                                                                                                                0.0s
 => => transferring dockerfile: 37B                                                                                                                                                                   0.0s
 => [internal] load metadata for docker.io/library/debian:jessie                                                                                                                                      0.0s
 => [1/3] FROM docker.io/library/debian:jessie                                                                                                                                                        0.0s
 => CACHED [2/3] RUN sleep 5                                                                                                                                                                          0.0s
 => CACHED [3/3] RUN echo 222 2222                                                                                                                                                                    0.0s
 => exporting to image                                                                                                                                                                                0.0s
 => => exporting layers                                                                                                                                                                               0.0s
 => => writing image sha256:77bd3f97932e3a7f47e97658da199c35624f1ee156b93d61d84c4fcde1fdf7f9                                                                                                          0.0s
 => => naming to docker.io/library/image2                                                                                                                                                             0.0s

As you can see, both images are equal and have the same hash. This is a bug.
The issue does not appear if Dockerfile names are not the same. For example image1/Dockerfile1 and image2/Dockerfile2

I'm not familiar with docker buildkit, but if you have thoughts on how it could be fixed, please post them here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant