Run the Oracle Cloud Infrastructure CLI from a Docker or Podman container, without installing oci-cli directly on your host.
| Feature | Details |
|---|---|
| 🧰 OCI CLI included | Builds a local image with oci-cli installed |
| 🐳 Docker/Podman support | Choose your runtime from env.mk |
| 🔐 Host OCI config | Reuses your local $HOME/.oci configuration |
| 🌐 Proxy build option | Use make oci-proxy when a proxy is required |
| File | Purpose |
|---|---|
oci-cli_containerfile |
Container build recipe |
Makefile |
Build, update, and cleanup commands |
env.mk |
Runtime, version, revision, and proxy settings |
| Command | Description |
|---|---|
make oci |
🏗️ Build the OCI CLI container image |
make oci-proxy |
🌐 Build the image using HTTP_PROXY from env.mk |
make oci-cleanup |
🧹 Remove the local OCI CLI image |
make oci-update |
🔄 Rebuild the image from scratch |
-
Edit
env.mkand select your runtime:RUNTIMECT=$(PODMAN) # RUNTIMECT=$(DOCKER)
-
Build the image:
make oci
If you need a proxy, set
HTTP_PROXYinenv.mkand run:make oci-proxy
-
Add an
ocialias to your shell profile.For Podman:
alias oci='podman run --rm -it --userns=keep-id -v "$HOME/.oci:$HOME/.oci:z" --tmpfs /run --tmpfs /tmp oci'
For Docker:
alias oci='docker run --rm -it -v "$HOME/.oci:$HOME/.oci" -v /sys/fs/cgroup:/sys/fs/cgroup:ro --tmpfs /run --tmpfs /tmp oci'
oci os ns get{
"data": "mytenancy"
}💡 Your OCI CLI configuration stays on the host under
$HOME/.oci.
Ruggero Citton
MIT License