tech687
(Tech687)
February 8, 2025, 11:43am
1
├── external
│ └── Dockerfile
└── project
├── compose.yml
└── Dockerfile
Let’s examine the contents of the files
+ cat external/Dockerfile
FROM scratch AS external
COPY <<EOF /test/external-hello
Hello!!!
EOF
+ cat project/compose.yml
services:
hello:
build:
context: .
additional_contexts:
external: ../external
command: cat /test/hello
+ cat project/Dockerfile
FROM scatch
COPY --from=external /test/external-hello /test/hello
Let’s do some tests
+ docker compose -f project/compose.yml run --rm hello
[+] Creating 1/0
✘ Network project_default Error 0.0s
failed to create network project_default: Error response from daemon: all predefined address pools have been fully subnetted
Why?
rimelek
(Ákos Takács)
February 8, 2025, 12:11pm
2
Nothing to do with Dockerfiles. You probably run too many compose projects and there are no available ipranges left for your new projects. Delete the old networks.
tech687
(Tech687)
February 8, 2025, 3:31pm
3
+ docker network prune
WARNING! This will remove all custom networks not used by at least one container.
Are you sure you want to continue? [y/N] y
+ docker compose -f project/compose.yml run --rm hello
[+] Creating 1/1
✔ Network project_default Created 0.1s
[+] Building 0.1s (5/5) FINISHED docker:default
=> [hello internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 104B 0.0s
=> [hello context external] load .dockerignore 0.0s
=> => transferring external: 2B 0.0s
=> [hello internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [hello context external] load from client 0.0s
=> => transferring external: 2B 0.0s
=> ERROR [hello stage-0 1/1] COPY --from=external /test/external-hello /test/hello 0.0s
------
> [hello stage-0 1/1] COPY --from=external /test/external-hello /test/hello:
------
failed to solve: failed to compute cache key: failed to calculate checksum of ref 2f3be2ff-461b-400a-9dc7-67650870d8fb::oqy8sq0jiuj15v75fsw7up18j: "/test/external-hello": not found
So what is the purpose of what is written here docker - Can a Dockerfile extend another one? - Stack Overflow ?
system
(system)
Closed
February 18, 2025, 3:32pm
4
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.