[BUG] failed to solve: base name (${FROM}) should not be blank
Description
When merging two Compose files I cannot build my own image and I get "failed to solve: base name (${FROM}) should not be blank" I have not found a solution yet other than to remove the netbox-docker compose file.
Not working:
Command:
docker compose \
-f third_party/netbox-docker/docker-compose.yml \
-f docker-compose.yml \
-p netbox-deployer \
build
docker-compose.yml:
version: '3.8'
services:
netbox:
networks:
default:
development:
ipv4_address: 10.10.10.2
app:
build: .
command: go run . worker
develop:
watch:
- action: sync+restart
path: ./
target: /app
ignore:
- .git
networks:
default:
development:
ipv4_address: 10.10.10.3
networks:
development:
driver: bridge
ipam:
config:
- subnet: 10.10.10.0/24
Working:
Command:
docker compose \
-f docker-compose.yml \
-p netbox-deployer \
build
docker-compose.yml:
version: '3.8'
services:
#netbox:
# networks:
# default:
# development:
# ipv4_address: 10.10.10.2
app:
build: .
command: go run . worker
develop:
watch:
- action: sync+restart
path: ./
target: /app
ignore:
- .git
networks:
default:
development:
ipv4_address: 10.10.10.3
networks:
development:
driver: bridge
ipam:
config:
- subnet: 10.10.10.0/24
I would expect that merging Compose files would not brake building my app image.
Steps To Reproduce
No response
Compose Version
Docker Compose version v2.24.2
Docker Environment
Client: Docker Engine - Community
Version: 25.0.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.12.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.24.2
Path: /usr/libexec/docker/cli-plugins/docker-compose
scan: Docker Scan (Docker Inc.)
Version: v0.23.0
Path: /usr/libexec/docker/cli-plugins/docker-scan
Server:
Containers: 468
Running: 0
Paused: 0
Stopped: 468
Images: 95
Server Version: 25.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: a1496014c916f9e62104b33d1bb5bd03b0858e59
runc version: v1.1.11-0-g4bccb38
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.6.10-76060610-generic
Operating System: Pop!_OS 22.04 LTS
OSType: linux
Architecture: x86_64
CPUs: 8
Total Memory: 15.47GiB
Name: deno
ID: 6SEM:LSTQ:6W4H:O2RC:A6UX:GXRK:JMCC:SRV5:7OHU:LQAJ:7QXM:XN5V
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Anything else?
My project, if that helps: https://github.com/dylode/netbox-deployer
As you run docker compose -f third_party/netbox-docker/docker-compose.yml ... the project directory is set to the parent folder of this first compose file (third_party/netbox-docker) and so relative paths are resolved based on it
You can confirm using docker compose config:
$ docker compose -f third_party/netbox-docker/docker-compose.yml -f docker-compose.yml -p netbox-deployer config
name: netbox-deployer
services:
app:
build:
context: /Users/nicolas/truc/netbox-deployer/third_party/netbox-docker
dockerfile: Dockerfile
...
To keep project directory relative to your current working directory, pass your local compose file first:
$ docker compose -f docker-compose.yml -f third_party/netbox-docker/docker-compose.yml <command>`
Still, file in the second file will then fail to resolve relative paths. Your use case is a typical example to use include so you can rely on third-party compose file
@ndeloof Thanks. So I was actually loading the Docker file from netbox-docker. Got it. I was trying to merge Compose files (add my network to the netbox container), this doesn't seem to work anymore with include.
https://docs.docker.com/compose/multiple-compose-files/merge/
Unfortunately I did miss the warning, so what I tried to achieve might not be possible.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.