Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
docker-outside-of-docker: ./**/docker-outside-of-docker/**
docker-outside-of-docker-compose: ./**/docker-outside-of-docker-compose/**
docker-in-docker: ./**/docker-in-docker/**
fedora: ./**/fedora/**
ubi: ./**/ubi/**
podman-in-podman: ./**/podman-in-podman/**
dotnet: ./**/dotnet/**
dotnet-fsharp: ./**/dotnet-fsharp/**
dotnet-mssql: ./**/dotnet-mssql/**
Expand Down
27 changes: 27 additions & 0 deletions src/fedora/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Fedora base image for Dev Containers
# [Choice] Fedora version: 43, 42, 41, latest, rawhide
ARG VARIANT=43
FROM registry.fedoraproject.org/fedora:${VARIANT}

# Install base packages needed for Dev Container features
RUN dnf install -y \
curl \
wget \
ca-certificates \
findutils \
which \
tar \
gzip \
unzip \
shadow-utils \
procps-ng \
sudo \
glibc-langpack-en \
&& dnf clean all

# Set locale to avoid warnings
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8

# Note: The common-utils feature will create the vscode user and install additional tools

40 changes: 40 additions & 0 deletions src/fedora/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/fedora
{
"name": "Fedora",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "${templateOption:imageVariant}"
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// Note: Zsh is installed but Bash remains the default shell (matching official templates)
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true,
"installOhMyZsh": true,
"username": "vscode",
"userUid": "1000",
"userGid": "1000",
"upgradePackages": true
},
"ghcr.io/devcontainers/features/git:1": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "cat /etc/fedora-release",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"remoteUser": "vscode"
}


44 changes: 44 additions & 0 deletions src/fedora/NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## Using this template

This template creates a Fedora-based development container. Fedora provides cutting-edge packages and is the upstream source for Red Hat Enterprise Linux.

### Fedora Version Options

| Version | Description |
|---------|-------------|
| `43` | Fedora 43 (current stable, October 2025) |
| `42` | Fedora 42 (previous stable) |
| `41` | Fedora 41 (extended support) |
| `latest` | Latest stable Fedora release |
| `rawhide` | Development/unstable version |

### Using with Podman

This template works well with Podman as the container engine. To configure VS Code to use Podman:

```json
{
"dev.containers.dockerPath": "podman"
}
```

### Adding Development Tools

You can add language-specific tools using [Dev Container Features](https://containers.dev/features). For example, to add Python:

```json
"features": {
"ghcr.io/devcontainers/features/python:1": {}
}
```

Or install packages directly using `dnf`:

```json
"postCreateCommand": "sudo dnf install -y nodejs golang rust"
```

### Multi-Architecture Support

Fedora images are available for both `x86_64` and `aarch64` (ARM64/Apple Silicon).

28 changes: 28 additions & 0 deletions src/fedora/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"id": "fedora",
"version": "1.0.0",
"name": "Fedora",
"description": "Simple Fedora container with Git and common utilities installed.",
"documentationURL": "https://github.com/devcontainers/templates/tree/main/src/fedora",
"publisher": "Dev Container Spec Maintainers",
"licenseURL": "https://github.com/devcontainers/templates/blob/main/LICENSE",
"options": {
"imageVariant": {
"type": "string",
"description": "Fedora version:",
"proposals": [
"43",
"42",
"41",
"latest",
"rawhide"
],
"default": "43"
}
},
"platforms": ["Any"],
"optionalPaths": [
".github/*"
]
}

97 changes: 97 additions & 0 deletions src/podman-in-podman/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Podman-in-Podman for Dev Containers
# Allows running containers inside a dev container using Podman

# [Choice] Podman version tag: latest or any version (e.g., v5.7.1, v5.7, v5, 5.7.1)
# Version tags use 'v' prefix (e.g., v5.7.1, v5.7, v5)
# The 'v' prefix is optional in input - if you specify '5.7.1', it will be used as 'v5.7.1'
# For best results, specify the full tag with 'v' prefix (e.g., 'v5.7.1', 'v5.7', 'v5')
ARG VARIANT=latest
ARG PODMAN_TAG
ARG INSTALL_BUILDAH="true"
ARG INSTALL_SKOPEO="true"

# Official Podman images from quay.io
# Tag format: quay.io/podman/stable:latest or quay.io/podman/stable:v5.7.1, v5.7, v5, etc.
# PODMAN_TAG is calculated and passed from devcontainer.json:
# - 'latest' -> 'latest'
# - Other versions -> add 'v' prefix if not present (e.g., '5.7.1' -> 'v5.7.1', 'v5.7.1' -> 'v5.7.1')
# Default to 'latest' if PODMAN_TAG is not provided
FROM quay.io/podman/stable:${PODMAN_TAG:-latest}

# For official Podman images, Podman is already installed
# Install additional tools and optional components
RUN dnf install -y \
shadow-utils \
sudo \
curl \
wget \
ca-certificates \
findutils \
which \
tar \
gzip \
unzip \
procps-ng \
glibc-langpack-en \
podman-docker \
&& dnf clean all

# Install optional tools based on build arguments
# Note: ARG must be redeclared after FROM to be available in this stage
ARG INSTALL_BUILDAH
ARG INSTALL_SKOPEO
RUN if [ "${INSTALL_BUILDAH}" = "true" ]; then \
dnf install -y buildah && dnf clean all; \
fi \
&& if [ "${INSTALL_SKOPEO}" = "true" ]; then \
dnf install -y skopeo && dnf clean all; \
fi

# Configure subuid/subgid for rootless containers (will be set up by common-utils feature)
# Using UID/GID 1001 to avoid conflicts with existing users in official Podman image
RUN echo "vscode:100000:65536" >> /etc/subuid \
&& echo "vscode:100000:65536" >> /etc/subgid \
&& echo "1001:100000:65536" >> /etc/subuid \
&& echo "1001:100000:65536" >> /etc/subgid

# Configure Podman for nested container operation
RUN mkdir -p /etc/containers \
&& echo '[containers]' > /etc/containers/containers.conf \
&& echo 'netns="host"' >> /etc/containers/containers.conf \
&& echo 'userns="host"' >> /etc/containers/containers.conf \
&& echo 'ipcns="host"' >> /etc/containers/containers.conf \
&& echo 'utsns="host"' >> /etc/containers/containers.conf \
&& echo 'cgroupns="host"' >> /etc/containers/containers.conf \
&& echo 'log_driver = "k8s-file"' >> /etc/containers/containers.conf \
&& echo '' >> /etc/containers/containers.conf \
&& echo '[engine]' >> /etc/containers/containers.conf \
&& echo 'cgroup_manager = "cgroupfs"' >> /etc/containers/containers.conf \
&& echo 'events_logger = "file"' >> /etc/containers/containers.conf

# Configure storage
RUN echo '[storage]' > /etc/containers/storage.conf \
&& echo 'driver = "overlay"' >> /etc/containers/storage.conf \
&& echo '' >> /etc/containers/storage.conf \
&& echo '[storage.options.overlay]' >> /etc/containers/storage.conf \
&& echo 'mount_program = "/usr/bin/fuse-overlayfs"' >> /etc/containers/storage.conf

# Set locale to avoid warnings
ENV LANG=en_US.UTF-8 \
LC_ALL=en_US.UTF-8

# Create /etc/machine-id if it doesn't exist (required by some tools)
# This is a dummy machine-id for container environments (32 hex chars, no hyphens per systemd spec)
RUN if [ ! -f /etc/machine-id ]; then \
if [ -f /proc/sys/kernel/random/uuid ]; then \
# Convert UUID format to 32-char hex string (remove hyphens) \
cat /proc/sys/kernel/random/uuid | tr -d '-' > /etc/machine-id; \
elif command -v dbus-uuidgen >/dev/null 2>&1; then \
dbus-uuidgen | tr -d '-' > /etc/machine-id; \
else \
# Fallback: generate 32 hex characters \
od -An -N16 -tx1 /dev/urandom | tr -d ' \n' > /etc/machine-id || \
echo "00000000000000000000000000000000" > /etc/machine-id; \
fi; \
fi

# Note: The common-utils feature will create the vscode user
65 changes: 65 additions & 0 deletions src/podman-in-podman/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/podman-in-podman
{
"name": "Podman in Podman",
"build": {
"dockerfile": "Dockerfile",
"args": {
"VARIANT": "${templateOption:imageVariant}",
"PODMAN_TAG": "${templateOption:imageVariant}",
"INSTALL_BUILDAH": "${templateOption:installBuildah}",
"INSTALL_SKOPEO": "${templateOption:installSkopeo}"
}
},

// Required for nested container operations
"runArgs": [
"--privileged",
"--security-opt", "label=disable"
],

// Persistent storage for container images
"mounts": [
{
"source": "devcontainer-podman-var-lib-${devcontainerId}",
"target": "/var/lib/containers",
"type": "volume"
}
],

// Features to add to the dev container. More info: https://containers.dev/features.
// Note: Using UID/GID 1001 to avoid conflicts with podman user in official image
// Zsh is installed but Bash remains the default shell (matching official templates)
"features": {
"ghcr.io/devcontainers/features/common-utils:2": {
"installZsh": true,
"installOhMyZsh": true,
"username": "vscode",
"userUid": "1001",
"userGid": "1001",
"upgradePackages": true
},
"ghcr.io/devcontainers/features/git:1": {}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Verify Podman is working (run as root for nested container operations)
"postCreateCommand": "sudo podman --version && sudo podman info --format '{{.Host.OCIRuntime.Name}}'",

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"redhat.vscode-yaml"
]
}
},

// Using root for nested container operations to avoid user namespace issues
// This is common for Podman-in-Podman scenarios
"remoteUser": "root"
}


Loading