containers / containers/podman-compose

Network mode in compose file build section not passed to Podman build command

Open
#1,027 1 comment 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
6.2k
Forks
622
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

When specifying the network mode in the build section of a docker-compose file, it does not get passed to the podman build command. The only way to set the network mode during the build process is too pass it through the podman-args

**Steps to reproduce the issue:**
`docker-compose.yml:`
```
version: '3'
services:
web:
image: gcr.io/google-samples/hello-app-build:1.0
build:
context: .
network: host
dockerfile: Dockerfile
ports:
- "${HOST_PORT:-8080}:8080"
```

`Dockerfile`:
```
FROM gcr.io/google-samples/hello-app:1.0
```

**Describe the results you received:**
Using `podman compose --verbose build` I get the following output
```
INFO:podman_compose:podman build -f /home/labuser/development/test/Dockerfile -t gcr.io/google-samples/hello-app-build:1.0 /home/labuser/development/test
```

**Describe the results you expected:**
Using podman-build-args as such `podman compose --verbose --podman-build-args="--network=host"` I get the following which allows the RUN commmands to run on the host network
```
INFO:podman_compose:podman build --network=host -f /home/labuser/development/test/Dockerfile -t gcr.io/google-samples/hello-app-build:1.0 /home/labuser/development/test
```

**Output of `rpm -q buildah` or `apt list buildah`:**

```
buildah-1.33.8-1.module+el8.10.0+21995+81e8507c.x86_64
```

**Output of `buildah version`:**

```
Version: 1.33.8
Go Version: go1.21.7 (Red Hat 1.21.7-2.module+el8.10.0+21638+b01be198)
Image Spec: 1.1.0-rc.5
Runtime Spec: 1.1.0
CNI Spec: 1.0.0
libcni Version: v1.1.2
image Version: 5.29.3
Git Commit:
Built: Tue Jun 18 05:33:28 2024
OS/Arch: linux/amd64
BuildPlatform: linux/amd64
```

**Output of `podman version` if reporting a `podman build` issue:**

```
Client: Podman Engine
Version: 4.9.4-rhel
API Version: 4.9.4-rhel
Go Version: go1.21.7 (Red Hat 1.21.7-2.module+el8.10.0+21638+b01be198)
Built: Tue Jun 18 05:34:14 2024
OS/Arch: linux/amd64
```

**Output of `cat /etc/*release`:**

```
NAME="Red Hat Enterprise Linux"
VERSION="8.10 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.10"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.10 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8"
BUG_REPORT_URL="https://issues.redhat.com/"

REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.10
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.10"
Red Hat Enterprise Linux release 8.10 (Ootpa)
Red Hat Enterprise Linux release 8.10 (Ootpa)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.