Skip to content

Support for Podman's preprocessed dockerfiles #1223

@rdong8

Description

@rdong8

podman build will apply the C preprocessor first if you give your Dockerfile a .in extension: https://docs.podman.io/en/latest/markdown/podman-build.1.html#description. This is incredibly useful if you want to have a base image for all your devcontainers with some common tools installed, and then layer on language-specific images. For example:

tools.Dockerfile:

FROM docker.io/debian:latest
RUN apt-get update && apt-get install -y vim

cpp.Dockerfile.in:

#include "tools.Dockerfile"
RUN apt-get update && apt-get install -y clang

This basically allows you to avoid having to build the base image by hand, which is not trivial since you have to manually pass in all the same flags to the builder as devcontainers-cli.

However, this causes errors with devcontainers-cli:

[2026-05-07T16:04:30.959Z] Start: Run: podman ps -q -a --filter label=devcontainer.local_folder=/home/rdong/projects/cpp_project --filter label=devcontainer.config_file=/home/rdong/projects/cpp_project/.devcontainer/devcontainer.json
[2026-05-07T16:04:31.014Z] Stop (55 ms): Run: podman ps -q -a --filter label=devcontainer.local_folder=/home/rdong/projects/cpp_project --filter label=devcontainer.config_file=/home/rdong/projects/cpp_project/.devcontainer/devcontainer.json
[2026-05-07T16:04:31.043Z] Error: Error parsing Dockerfile: Dockerfile contains no FROM instructions
[2026-05-07T16:04:31.043Z]     at vQ (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:393:12987)
[2026-05-07T16:04:31.043Z]     at xV (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:467:2349)
[2026-05-07T16:04:31.043Z]     at async Rp (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:467:1910)
[2026-05-07T16:04:31.043Z]     at async cG (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:467:608)
[2026-05-07T16:04:31.043Z]     at async A9 (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:485:4649)
[2026-05-07T16:04:31.043Z]     at async kI (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:485:5768)
[2026-05-07T16:04:31.043Z]     at async vZ (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:666:205)
[2026-05-07T16:04:31.043Z]     at async GZ (/home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:665:15080)
[2026-05-07T16:04:31.043Z]     at async /home/rdong/.vscode-remote-containers/dist/dev-containers-cli-0.460.0/dist/spec-node/devContainersSpecCLI.js:485:1917

Ideally these checks would be performed only on the preprocessed file, ie. the output of cpp -E cpp.Dockerfile.in.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions