Skip to content

Support Fedora Linux #2032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 28, 2025
Merged

Support Fedora Linux #2032

merged 1 commit into from
May 28, 2025

Conversation

basil
Copy link
Member

@basil basil commented May 25, 2025

Unlike Ubuntu Linux, Fedora uses SELinux instead of AppArmor, which requires the ":Z" option when bind-mounting local volumes into the container. From the man page:

To change a label in the container context, you can add either of two suffixes :z or :Z to the volume mount. These suffixes tell Docker to relabel file objects on the shared volumes. The z option tells Docker that two containers share the volume content. As a result, Docker labels the content with a shared content label. Shared volume labels allow all containers to read/write content. The Z option tells Docker to label the content with a private unshared label. Only the current container can use a private volume.

Using the :Z option on an Ubuntu system with Docker does not cause harm, but it is effectively ignored since SELinux is not active. Docker will still process the bind mount, and the container should function as expected, provided the AppArmor profile (if any) allows the necessary access. By default, Docker on Ubuntu ships with AppArmor profiles that are permissive enough for most bind-mount use cases.

Implementation notes

I also had to remove the shared temporary directory, as it was not compatible with SELinux either. Fortunately it does not appear to be needed.

Testing done

Ran ./ath-container.sh on Fedora.

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

MarkEWaite added a commit to MarkEWaite/jenkins.io that referenced this pull request May 25, 2025
jenkinsci/acceptance-test-harness#2032 shares
what Basil Crow learned about bind mounts on Docker containers using
Fedora Linux.

Fedora Linux SELinux requires the ":Z" option when bind-mounting local
volumes into the container.

Testing done:

Confirmed that `make run` fails on Fedora Linux 42 before this change
and passes after this change.

Confirmed that Ubuntu Linux does not have /usr/bin/sestatus in my
installation, so it should not be affected by this change.
gounthar pushed a commit to jenkins-infra/jenkins.io that referenced this pull request May 25, 2025
jenkinsci/acceptance-test-harness#2032 shares
what Basil Crow learned about bind mounts on Docker containers using
Fedora Linux.

Fedora Linux SELinux requires the ":Z" option when bind-mounting local
volumes into the container.

Testing done:

Confirmed that `make run` fails on Fedora Linux 42 before this change
and passes after this change.

Confirmed that Ubuntu Linux does not have /usr/bin/sestatus in my
installation, so it should not be affected by this change.
@basil basil marked this pull request as draft May 26, 2025 03:19
@basil basil marked this pull request as ready for review May 28, 2025 20:38
@basil basil marked this pull request as draft May 28, 2025 21:09
@basil basil marked this pull request as ready for review May 28, 2025 22:08
@basil basil merged commit 4a41b57 into jenkinsci:master May 28, 2025
25 checks passed
@basil basil deleted the fedora branch May 28, 2025 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants