Up and running fast with Python SDK for Oracle Cloud Infrastructure - Docker
This article describes an easy approach to get going with the Python SDK for Oracle Cloud Infrastructure — using the oci-python Docker image. Using a Docker container image and a simple configuration file, oci commands can be executed without locally having to install and update the OCI Python SDK on your local environment. You have to love Docker and its ability to encapsulate mundane error prone documentation steps!
The OCI Python SDK is here along with the general install doc here, this describes what is encapsulated in the docker Dockerfile here (similar to the OCI CLI docker image defined here). With docker its as easy as pulling/building the image and running a container and passing your OCI Python script.
Checkout the README.md file it has instructions for getting the docker image built and then you can run with an alias, with mounts (~/.oci for OCI config and PWD/current working directory for scripts) you can run scripts stored on the host using the docker container and use your host .oci/config file for authentication information for connecting to OCI.
For example the demo.py script can be run using the alias with a simple invocation;
ocipython demo.py
Like this;
Simple and easy to get going.
Resources
OCI Python SDK Documentation — https://docs.cloud.oracle.com/en-us/iaas/Content/API/SDKDocs/pythonsdk.htm
GitHub repo for OCI Python Docker — https://github.com/davidallan/oci-dockers/tree/master/python
OCI Python Examples — check it out- https://github.com/oracle/oci-python-sdk/tree/master/examples