Oracle Cloud Infrastructure (OCI) is a cloud platform that offers a range of services for modern application development and deployment. Among these services are OCI Containers and OCI Functions, which enable you to run your applications in a serverless and scalable way, without managing any infrastructure.
In this blog post, we will explain what OCI Containers and OCI Functions are, how they work, and how you can use them to build and run your applications on OCI.
OCI Containers are a service that allows you to run Docker containers on OCI without provisioning or managing any servers. You can use OCI Containers to run any application that can be packaged as a Docker image, such as web applications, microservices, batch jobs, or machine learning models.
OCI Containers are based on the open source Containerd project, which provides a lightweight runtime for containers. OCI Containers use the same API as Docker, so you can use the same tools and commands to interact with them.
OCI Containers offer the following benefits:
OCI Functions is a serverless compute service that lets you create, run, and scale functions on OCI. Functions are small pieces of code that perform a single task or logic, such as processing an event, transforming data, or calling an API.
OCI Functions is based on the open source Fn Project, which is a framework for building and running functions using any programming language. You can use the Fn CLI tool to create, deploy, and invoke functions on OCI Functions.
OCI Functions offer the following benefits:
To use OCI Containers and Functions, you need to have an OCI account and a tenancy. A tenancy is a secure and isolated environment where you can create and manage your resources on OCI.
You also need to have a Docker installation on your local machine to build and push your Docker images to OCIR. You can download Docker from https://www.docker.com/get-started.
To use OCI Containers, you need to do the following steps:
docker build
command. Your Docker image should contain your application code, libraries, and dependencies.docker push
command. You need to authenticate with OCIR using your OCI username and auth token.oci container-instances container create
command. A container instance is a running instance of your Docker image on OCI.oci container-instances container start
command or by clicking the Start button in the Console.oci container-instances
commands. You can view the logs, metrics, and events of your container instance, as well as stop, restart, or delete it.To use OCI Functions, you need to do the following steps:
curl -LSs https://raw.githubusercontent.com/fnproject/cli/master/install | sh
command.fn init
command. A function project is a directory that contains your function code, configuration files, and dependencies.fn run
command. This will build your function image and run it in a Docker container on your local machine.fn deploy
command. This will push your function image to OCIR and upload your function metadata to OCI Functions.fn invoke
command or by sending an HTTP request to the function's invoke endpoint. You can also trigger your function from other OCI services or external services using events or webhooks.fn
commands. You can view the logs, metrics, and events of your function, as well as update, delete, or list it.OCI Containers and Functions are powerful services that enable you to run your applications in a serverless and scalable way, without managing any infrastructure. You can use OCI Containers and Functions to build and run any type of application, such as web applications, microservices, batch jobs, or machine learning models.