-
Notifications
You must be signed in to change notification settings - Fork 45
Add support for running compute worker with other container engines (Podman) #772
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
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
111f31f
Remove container engine specfic directory name
cjh1 fd3f38b
Allow container engine to be configured
cjh1 36e3327
Ensure host directories exist
cjh1 63709e5
Add Containerfile for rootless podman container
cjh1 43e01d4
Adding Containerfile for building podman gpu compute_worker image
fd7d38f
Adding nvidia runtime config
3c27d79
Fix issue with shadow-utils
cjh1 d134c1e
Remove sudo
cjh1 da51014
Merge pull request #763 from cjh1/podman
Didayolo beb35f3
Merge pull request #775 from cjh1/podman
Didayolo c83e043
Optimize Containerfile in order to reduce image size
abf66f1
podman import error during tests
bbearce 1dbc65c
Merge branch 'podman' of https://github.com/codalab/codabench into po…
bbearce a463a0f
flake error
bbearce 32249a3
Revert file
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| FROM fedora:37 | ||
|
|
||
| # Include deps | ||
| RUN dnf -y update && \ | ||
| # https://bugzilla.redhat.com/show_bug.cgi?id=1995337#c3 | ||
| rpm --setcaps shadow-utils 2>/dev/null && \ | ||
| dnf -y install podman fuse-overlayfs python3.8 python3-pip \ | ||
| --exclude container-selinux && \ | ||
| dnf clean all && \ | ||
| rm -rf /var/cache /var/log/dnf* /var/log/yum.* | ||
|
|
||
| # Setup user | ||
| RUN useradd worker; \ | ||
| echo -e "worker:1:999\nworker:1001:64535" > /etc/subuid; \ | ||
| echo -e "worker:1:999\nworker:1001:64535" > /etc/subgid; | ||
|
|
||
| # Copy over the podman container configuration | ||
| COPY podman/containers.conf /etc/containers/containers.conf | ||
| COPY podman/worker-containers.conf /home/worker/.config/containers/containers.conf | ||
|
|
||
| # Copy over the podman storage configuration | ||
| COPY podman/worker-storage.conf /home/worker/.config/containers/storage.conf | ||
|
|
||
| RUN mkdir -p /home/worker/.local/share/containers && \ | ||
| chown worker:worker -R /home/worker && \ | ||
| chmod 644 /etc/containers/containers.conf | ||
|
|
||
| # Copy & modify the defaults to provide reference if runtime changes needed. | ||
| # Changes here are required for running with fuse-overlay storage inside container. | ||
| RUN sed -e 's|^#mount_program|mount_program|g' \ | ||
| -e '/additionalimage.*/a "/var/lib/shared",' \ | ||
| -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' \ | ||
| /usr/share/containers/storage.conf \ | ||
| > /etc/containers/storage.conf | ||
|
|
||
| # Add volume for containers | ||
| VOLUME /home/worker/.local/share/containers | ||
|
|
||
| # Create directory for tmp space | ||
| RUN mkdir /codabench && \ | ||
| chown worker:worker /codabench | ||
|
|
||
| # Set up podman registry for dockerhub | ||
| RUN echo -e "[registries.search]\nregistries = ['docker.io']\n" > /etc/containers/registries.conf | ||
|
|
||
| # This makes output not buffer and return immediately, nice for seeing results in stdout | ||
| ENV PYTHONUNBUFFERED 1 | ||
| ENV CONTAINER_ENGINE_EXECUTABLE podman | ||
|
|
||
| # Get pip for 3.8 | ||
| RUN python3.8 -m ensurepip --upgrade | ||
|
|
||
| WORKDIR /home/worker/compute_worker | ||
|
|
||
| ADD compute_worker/ /home/worker/compute_worker | ||
|
|
||
| RUN chown worker:worker -R /home/worker/compute_worker | ||
|
|
||
| RUN pip3.8 install -r /home/worker/compute_worker/compute_worker_requirements.txt | ||
|
|
||
| CMD celery -A compute_worker worker \ | ||
| -l info \ | ||
| -Q compute-worker \ | ||
| -n compute-worker@%n \ | ||
| --concurrency=1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| FROM fedora:37 | ||
|
|
||
| # Include deps | ||
| RUN curl -s -L https://developer.download.nvidia.com/compute/cuda/repos/rhel9/x86_64/cuda-rhel9.repo | tee /etc/yum.repos.d/cuda.repo && \ | ||
| curl -s -L https://nvidia.github.io/nvidia-docker/rhel9.0/nvidia-docker.repo | tee /etc/yum.repos.d/nvidia-docker.repo && \ | ||
| rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm && \ | ||
| rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm && \ | ||
| dnf -y update && \ | ||
| dnf module install -y nvidia-driver:latest-dkms && \ | ||
| dnf -y install podman fuse-overlayfs python3.8 python3-pip nvidia-container-runtime nvidia-container-toolkit \ | ||
| cuda --exclude container-selinux && \ | ||
| dnf clean all && \ | ||
| rm -rf /var/cache /var/log/dnf* /var/log/yum.* | ||
|
|
||
| # Setup user | ||
| RUN useradd worker; \ | ||
| echo -e "worker:1:999\nworker:1001:64535" > /etc/subuid; \ | ||
| echo -e "worker:1:999\nworker:1001:64535" > /etc/subgid; | ||
|
|
||
| # Copy over the podman container configuration | ||
| COPY podman/containers.conf /etc/containers/containers.conf | ||
| COPY podman/worker-containers.conf /home/worker/.config/containers/containers.conf | ||
|
|
||
| # Copy over the podman storage configuration | ||
| COPY podman/worker-storage.conf /home/worker/.config/containers/storage.conf | ||
|
|
||
| RUN mkdir -p /home/worker/.local/share/containers && \ | ||
| chown worker:worker -R /home/worker && \ | ||
| chmod 644 /etc/containers/containers.conf | ||
|
|
||
| # Copy & modify the defaults to provide reference if runtime changes needed. | ||
| # Changes here are required for running with fuse-overlay storage inside container. | ||
| RUN sed -e 's|^#mount_program|mount_program|g' \ | ||
| -e '/additionalimage.*/a "/var/lib/shared",' \ | ||
| -e 's|^mountopt[[:space:]]*=.*$|mountopt = "nodev,fsync=0"|g' \ | ||
| /usr/share/containers/storage.conf \ | ||
| > /etc/containers/storage.conf; sed -i 's/^#no-cgroups = false/no-cgroups = true/;' /etc/nvidia-container-runtime/config.toml | ||
|
|
||
|
|
||
| # Add volume for containers | ||
| VOLUME /home/worker/.local/share/containers | ||
|
|
||
| # This makes output not buffer and return immediately, nice for seeing results in stdout | ||
| ENV PYTHONUNBUFFERED 1 | ||
| ENV CONTAINER_ENGINE_EXECUTABLE podman | ||
|
|
||
| # Create directory for tmp space | ||
| RUN mkdir /codabench && \ | ||
| chown worker:worker /codabench && \ | ||
| # Set up podman registry for dockerhub | ||
| echo -e "[registries.search]\nregistries = ['docker.io']\n" > /etc/containers/registries.conf && \ | ||
| # Get pip for 3.8 | ||
| python3.8 -m ensurepip --upgrade | ||
|
|
||
| WORKDIR /home/worker/compute_worker | ||
|
|
||
| ADD compute_worker/ /home/worker/compute_worker | ||
|
|
||
| RUN chown worker:worker -R /home/worker/compute_worker && \ | ||
| pip3.8 install -r /home/worker/compute_worker/compute_worker_requirements.txt | ||
|
|
||
| CMD nvidia-smi && celery -A compute_worker worker \ | ||
| -l info \ | ||
| -Q compute-worker \ | ||
| -n compute-worker@%n \ | ||
| --concurrency=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [containers] | ||
| netns="host" | ||
| userns="host" | ||
| ipcns="host" | ||
| utsns="host" | ||
| cgroupns="host" | ||
| cgroups="disabled" | ||
| log_driver = "k8s-file" | ||
| [engine] | ||
| cgroup_manager = "cgroupfs" | ||
| events_logger="file" | ||
| runtime="crun" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| [containers] | ||
| volumes = [ | ||
| "/proc:/proc", | ||
| ] | ||
| default_sysctls = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| [storage] | ||
| driver = "overlay" | ||
|
|
||
| [storage.options.overlay] | ||
| mount_program = "/usr/bin/fuse-overlayfs" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dtuantran How much space does this save? Just wondering if it's worth it given the loss of readability and ease of development, by having multiple steps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't save much space, sorry that I push it too quick, I've reverted back this file.