Container Instance:
OCI Container Instances enables you to easily run applications on serverless compute optimized for containers.
Using Container Instances, you can easily launch one or more containers with flexibility to specify compute shape, resource allocation, networking, and other optional configurations.
How to create Container Instance in OCI
Go to OCI --> Developer Services --> Container Instances --> Click on Create container instance
There are 3 steps in Container instance creation
1. Add basic details
Here we provide the container name, compartment, Availability domain and Fault domain, Choose the shape.
Only 2 Shapes available here CI.Standard.E4.Flex and CI.Standard.E3.Flex, choose the OCPUs and memory for whatever shape we choose.
I select 4 OCPUs and 8 GB of memory
For Networking part, I already have VCN, subnet so I choose to select those, you can also create new VCN here if you don't have one.
2. Configure containers - Here we can add as many container as we need depend on resources we choose in 1st step.
I will configure 2 containers to setup this WordPress website (one will use WordPress image and another will use MySQL DB Image)
There are 2 ways to select Image when configure containers in OCI, one using OCI container registry and another using external registry (like docker hub)
So I choose WordPress Image from docker hub and MySQL Image from OCIR registry.
For How to setup OCIR Image, you can see my previous Blog.
Here I choose WordPress docker Image for 1st container
Add these environment variable as per the Image description on docker hubEnable resource throttling and assign 50% resource to this container.
Click on +another container and add MySQL container
This time I choose the Image from my OCIR registry
If registry is Private you have to specify credentials
Now setup some environment variables to initialize the MYSQL database as per Image description.
We also need to pass below argument to enable database password authentication plugin
Click Next
3. Review all the information before create container Instance.
And Click Create, It will take few seconds to launch the container instances
You can see 2 containers each utilizing 50% resources as we setup
So we assigned the public IP to this Instance, using which we can access this WordPress website.
Before that make sure port 80 is open as WordPress site use port 80, so go your security list and open port 80 on Ingress rules.
No comments:
Post a Comment