Skip to content

jelipo/ocipack-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


ocipack


Quickly build simple Docker/OCI images without runtime

GitHub last commit GitHub release (latest by date) GitHub all releases GitHub repo size Github Release Publish Status License

Overview

The original purpose of ocipack was to build simple image without Runtime.

Now you can also:

  • Pull image to a file without Runtime
  • Display the image details of the image repository.
  • Transform between Docker and OCI format.

Download

Linux / MacOS

curl -L https://github.com/jelipo/ocipack-rs/releases/download/0.7.2/ocipack-0.7.2-amd64_$(uname).tar.gz | tar xzv

# [Option] Move to /usr/local/bin/
sudo cp ocipack /usr/local/bin/ &&  sudo chmod +x /usr/local/bin/ocipack

Windows

curl.exe -L https://github.com/jelipo/ocipack-rs/releases/download/0.7.2/ocipack-0.7.2-amd64_windows.zip -o ocipack.zip

tar -xf ocipack.zip

How to use

Create a Dockerfile.

FROM ubuntu:24.04
COPY Dockerfile /root/
CMD cat /root/Dockerfile

Run this command.

ocipack build \
  --source=dockerfile:./Dockerfile \
  --target=registry:my.harbor.com/jelipo/demo:v1 \
  --target-auth=jelipo:my_password

Now a simple image has been pushed to the image repository.

Build job successful!

Target image:
my.harbor.com/jelipo/demo:v1

You can also save the image as a file, just modify the --target parameter.

--target=tgz:demo.tgz

Support Dockerfile?

No.

Because there is no runtime, instructions such as RUN, ARG, and MAINTAINER in the image cannot be supported.

The example above uses Dockerfile because Dockerfile is more familiar to most people.

instructions
Support FROM LABEL CMD COPY ENV USER WORKDIR EXPOSE
TODO ADD ENTRYPOINT VOLUME
Not support ARG RUN MAINTAINER

Proxy

If you are in China or offline with a proxy provided, you may not be able to pull/push images from the Docker Hub repository properly.

You can use the proxy to pull/push images.

ocipack build \
  --source=registry:redis:latest \
  --target=tgz:redis.tgz \
  --source-proxy=socks5://127.0.0.1:1080
  --target-proxy=http://name:[email protected]:7890

Platform

You can use the --platform parameter to set the platform of the image.

If not set, linux/amd64 will be used by default.

Transform

Transform between Docker and OCI format. Use ocipack transform .

ocipack transform --help

Show Image Info

If you want to view the image information in the image warehouse, use this command.

me@jelipo:~$ ocipack show-info -i registry:alpine:latest
[23:18:26.011 INFO] Requesting registry...
[23:18:28.249 INFO] Platform is not set, use default platform linux/amd64.
[23:18:29.359 INFO] Request done.

IMAGE DETAILS

HOST            : registry-1.docker.io
IMAGE_NAME      : library/alpine
IMAGE_REFERENCE : latest
MANIFEST_TYPE   : Docker V2,Schema2
OS              : linux
ARCH            : amd64
CMD             : ["/bin/sh"]
ENTRYPOINT      : NONE

MANIFEST_LIST_PLATFORMS:
linux/amd64,
...

MANIFEST_LIST_RAW:
{...}

MANIFEST_RAW    :
{...}

CONFIG_BLOB_RAW :
{...}

Clean Cache

ocipack clean -a

Supported Manifest

version support
Image Manifest V 2, Schema 2 βœ…
Image Manifest V 2, Schema 1 ❌
OCI Image Manifest βœ…

Build

cargo build --release

TODO

  • Export or import to container engine.
  • More Dockerfile instructions.

Final

Thanks for using, please give feedback if you have any questions.