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
andOCI
format.
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
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
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
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 |
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
You can use the --platform
parameter to set the platform of the image.
If not set, linux/amd64
will be used by default.
Transform between Docker
and OCI
format. Use ocipack transform
.
ocipack transform --help
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 :
{...}
ocipack clean -a
version | support |
---|---|
Image Manifest V 2, Schema 2 |
โ |
Image Manifest V 2, Schema 1 |
โ |
OCI Image Manifest |
โ |
cargo build --release
- Export or import to container engine.
- More Dockerfile instructions.
Thanks for using, please give feedback if you have any questions.