Skip to content

[BUG] Bake is not following the network mode in the docker-compose.yml file #12951

Description

@pmaoui

Description

Hello,

On a fresh AL2023 install, I have disabled the bridge network by having:

{
"bridge": "none"
}

docker-compose.yml:

services:
my-server:
container_name: my-server
build:
context: .
network: host
network_mode: host

Dockerfile:

FROM node:20.17.0
RUN apt-get update && apt-get install -y build-essential vim

When I run docker compose up:

Dockerfile:3
--------------------
1 | FROM node:20.17.0
2 |
3 | >>> RUN apt-get update && apt-get install -y build-essential vim
4 |
--------------------
failed to solve: process "/bin/sh -c apt-get update && apt-get install -y build-essential vim" did not complete successfully: network bridge not found

Doing COMPOSE_BAKE=false docker compose up fix this issue

Steps To Reproduce

No response

Compose Version

Docker Compose version v2.37.1

Docker Environment

Client: Docker Engine - Community
Version: 28.2.2
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.24.0
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.37.1
Path: /root/.docker/cli-plugins/docker-compose
Server:
Containers: 5
Running: 0
Paused: 0
Stopped: 5
Images: 5
Server Version: 28.2.2
Storage Driver: overlay2
Backing Filesystem: xfs
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
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 05044ec0a9a75232cad458027ca83437aae3f4da
runc version: v1.2.5-0-g59923ef
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 6.1.140-154.222.amzn2023.x86_64
Operating System: Amazon Linux 2023.7.20250609
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 30.64GiB
Name: ip-172-31-0-154.eu-central-1.compute.internal
ID: 03ced070-dbf8-4fa8-8ce9-8728d13dc989
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Live Restore Enabled: true

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions