Apptainer / Push Container Image To Oci Registry
Push Container Image To Oci Registry
Apptainer command syntax to push container image to oci registry. Copyable examples, output expectations, and common mistakes.
$
Terminal apptainer push <path/to/image.sif> oras://<registry/namespace/image>:<tag> apptainer push <path/to/image.sif> oras://<registry/namespace/image>:<tag> #!/bin/bash
# Push Container Image To Oci Registry
apptainer push {{path/to/image.sif}} oras://{{registry/namespace/image}}:{{tag}} import subprocess
# Push Container Image To Oci Registry
# Make sure to replace <placeholders> with actual values
def run_command():
cmd = [
"apptainer",
"push",
"<path/to/image.sif>",
"oras://<registry/namespace/image>:<tag>"
]
try:
print(f"Executing: {' '.join(cmd)}")
subprocess.run(cmd, check=True)
except subprocess.CalledProcessError as e:
print(f"Error: {e}")
except FileNotFoundError:
print("Error: apptainer not found. Please install it first.")
if __name__ == "__main__":
run_command() Command Breakdown
What each part is doing
-
apptainer - Base Command
- The executable that performs this operation. Here it runs Apptainer before the shell applies any redirect operators.
-
<path/to/image.sif> - path to image.sif
- The value supplied for path to image.sif.
-
<registry/namespace/image> - registry namespace image
- The value supplied for registry namespace image.
-
<tag> - tag
- The value supplied for tag.
Alternative Approaches
Comparable commands in other tools
Alternative containers tools for the same job.