Last active
August 18, 2020 14:00
-
-
Save errordeveloper/7a078c53d4694f0cad9a727255fb23a6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create an new direcotry with a very simple dockerfile | |
$ mkdir quay-issue && cd mkdir quay-issue | |
$ echo 'FROM scratch' > Dockerfile | |
# buildx auto-push only works with a builxkit driver, so we need to create a builder instance | |
$ docker buildx create --use | |
gifted_lewin | |
# try building and pushing to docker.io | |
$ docker buildx build --push --tag "docker.io/errordeveloper/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip" . | |
[+] Building 2.9s (3/3) FINISHED | |
=> [internal] load build definition from Dockerfile 0.0s | |
=> => transferring dockerfile: 31B 0.0s | |
=> [internal] load .dockerignore 0.0s | |
=> => transferring context: 2B 0.0s | |
=> exporting to image 2.8s | |
=> => exporting layers 0.0s | |
=> => exporting manifest sha256:bc79dee9c249163d7dd55e3697ef90d0772220fda30e2f3fc4d007f60a368b11 0.0s | |
=> => exporting config sha256:71de1148337f4d1845be01eb4caf15d78e4eb15a1ab96030809826698a5b7e30 0.0s | |
=> => pushing layers 2.4s | |
=> => pushing manifest for docker.io/errordeveloper/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip | |
# that worked, now try quay.io... | |
$ docker buildx build --push --tag "quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip" . | |
[+] Building 4.0s (4/4) FINISHED | |
=> [internal] booting buildkit 2.5s | |
=> => pulling image moby/buildkit:buildx-stable-1 2.0s | |
=> => creating container buildx_buildkit_gifted_lewin0 0.5s | |
=> [internal] load build definition from Dockerfile 0.0s | |
=> => transferring dockerfile: 50B 0.0s | |
=> [internal] load .dockerignore 0.0s | |
=> => transferring context: 2B 0.0s | |
=> ERROR exporting to image 1.4s | |
=> => exporting layers 0.0s | |
=> => exporting manifest sha256:bc79dee9c249163d7dd55e3697ef90d0772220fda30e2f3fc4d007f60a368b11 0.0s | |
=> => exporting config sha256:71de1148337f4d1845be01eb4caf15d78e4eb15a1ab96030809826698a5b7e30 0.0s | |
=> => pushing layers 0.6s | |
=> => pushing manifest for quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip 0.8s | |
------ | |
> exporting to image: | |
------ | |
failed to solve: rpc error: code = Unknown desc = failed commit on ref "manifest-sha256:bc79dee9c249163d7dd55e3697ef90d0772220fda30e2f3fc4d007f60a368b11": unexpected status: 401 UNAUTHORIZED | |
# try using plain old 'docker build' | |
$ docker build --tag "quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip" . | |
Sending build context to Docker daemon 2.048kB | |
Step 1/1 : FROM scratch | |
---> | |
No image was generated. Is your Dockerfile empty? | |
# okay, maybe we can cannot have empty images - add a file | |
$ echo > empty | |
$ echo 'COPY empty /empty' >> Dockerfile | |
$ cat Dockerfile | |
FROM scratch | |
COPY empty /empty | |
$ docker build --tag "quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip" . | |
Sending build context to Docker daemon 3.072kB | |
Step 1/2 : FROM scratch | |
---> | |
Step 2/2 : COPY empty /empty | |
---> 3ad5d73f4f64 | |
Successfully built 3ad5d73f4f64 | |
Successfully tagged quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip | |
$ docker push "quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip" | |
The push refers to repository [quay.io/isovalent/gke-test-cluster-job-runner-init] | |
f0fc455805c2: Pushed | |
e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip: digest: sha256:24b039bb9064492c58b93330dbdb3fa03db49dbb2fc06ae6829dabd5e2f9eb7e size: 524 | |
# looks like it's happy, now try buildx again: | |
$ docker buildx build --push --tag "quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip" . | |
[+] Building 4.6s (5/5) FINISHED | |
=> [internal] load build definition from Dockerfile 0.0s | |
=> => transferring dockerfile: 68B 0.0s | |
=> [internal] load .dockerignore 0.0s | |
=> => transferring context: 2B 0.0s | |
=> [internal] load build context 0.0s | |
=> => transferring context: 33B 0.0s | |
=> [1/1] COPY empty /empty 0.0s | |
=> ERROR exporting to image 4.5s | |
=> => exporting layers 0.0s | |
=> => exporting manifest sha256:3db7309b631570bc5194924147864ecc0c420bbc2454858116c60d3f27ad12fd 0.0s | |
=> => exporting config sha256:432f1a440b56ac47633f231da7b24e80596cfc42e7b14b428cf052e920ddc6d4 0.0s | |
=> => pushing layers 3.6s | |
=> => pushing manifest for quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip 0.8s | |
------ | |
> exporting to image: | |
------ | |
failed to solve: rpc error: code = Unknown desc = failed commit on ref "manifest-sha256:3db7309b631570bc5194924147864ecc0c420bbc2454858116c60d3f27ad12fd": unexpected status: 400 BAD REQUEST | |
# that seems to be problematic, what about adding another file and using 'ADD'? | |
$ echo 123 > something | |
$ echo 'ADD something /something' >> Dockerfile | |
$ cat Dockerfile | |
FROM scratch | |
COPY empty /empty | |
ADD something /something | |
$ docker buildx build --push --tag "quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip" . | |
[+] Building 4.6s (6/6) FINISHED | |
=> [internal] load .dockerignore 0.0s | |
=> => transferring context: 2B 0.0s | |
=> [internal] load build definition from Dockerfile 0.0s | |
=> => transferring dockerfile: 93B 0.0s | |
=> [internal] load build context 0.0s | |
=> => transferring context: 68B 0.0s | |
=> CACHED [1/2] COPY empty /empty 0.0s | |
=> [2/2] ADD something /something 0.0s | |
=> exporting to image 4.5s | |
=> => exporting layers 0.0s | |
=> => exporting manifest sha256:052b2d359ee84499913f38661529e9207314f2b01dd91578056151da86cc9174 0.0s | |
=> => exporting config sha256:347b7341c64ff93cc214bfcfdde517a94324b4bac2c39afbe2dd3fa0eb8ebd63 0.0s | |
=> => pushing layers 3.4s | |
=> => pushing manifest for quay.io/isovalent/gke-test-cluster-job-runner-init:e8e34968c060a23cfbfb27012d38e5ccbd3e27fe-dev-wip 1.1s | |
# somehow it works now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this works: | |
FROM scratch | |
COPY empty /empty | |
COPY something /something | |
# this works too | |
FROM scratch | |
ADD empty /empty | |
ADD something /something | |
# and this | |
FROM scratch | |
COPY empty /empty | |
COPY empty /something | |
# this DOES NOT work: | |
FROM scratch | |
COPY something /something | |
# or this | |
FROM scratch | |
ADD something /something | |
# or this | |
FROM scratch | |
COPY empty /empty | |
# or this | |
FROM scratch | |
ADD empty /empty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment