This Vagrant project will provision an Oracle Linux 7 VM running a local Container Registry.
It can be used as cache for the Oracle Container Registry, in particular for the Kubernetes containers.
- Read the prerequisites in the top level README to set up Vagrant with either VirtualBox or KVM
- Sign in to Oracle Container Registry and accept the Oracle Standard Terms and Restrictions for the Container Services Business Area.
- Clone this repository
git clone https://github.com/oracle/vagrant-projects
- Change into the
vagrant-projects/ContainerRegistry
directory - Run
vagrant up; vagrant ssh
Your local container registry is up and running!
The Vagrant project can be used as-is; there are a couple of parameters you can set to tailor the installation to your needs.
There are several ways to set parameters:
- Update the Vagrantfile. This is straightforward; the downside is that you will loose changes when you update this repository.
- Use environment variables. Might be difficult to remember the parameters used when the VM was instantiated.
- Use the
.env
/.env.local
files (requires vagrant-env plugin). Configure your Registry by editing the.env
file; or better copy.env
to.env.local
and edit the latter one, it won't be overridden when you update this repository and it won't mark your git tree as changed (you won't accidentally commit your local configuration!)
Parameters are considered in the following order (first one wins):
- Environment variables
.env.local
(if vagrant-env plugin is installed).env
(if vagrant-env plugin is installed)- Vagrantfile definitions
REGISTRY_IP
(default: 192.168.99.253): the VM will join the VirtualBox private network using this IP.REGISTRY_BIND
(default: undefined): if this variable is defined, Vagrant will bind the registry port (5000) from the VM to the specified port on the host, making the local registry available outside of the Vagrant environment.
We can use our local container registry to mirror the Kubernetes containers
for a faster deployment of a [Vagrant] Kubernetes cluster.
The scripts
directory contains the kubeadm-setup-registry.sh
convenience
script for this task.
vagrant ssh
in your registry VM- as
vagrant
user run:
/vagrant/scripts/kubeadm-setup-registry.sh
You will be asked to log in to the Oracle Container Registry.
If you want to mirror from an Oracle Container Registry Mirror, use the--from
parameter, e.g.:
/vagrant/scripts/kubeadm-setup-registry.sh --from container-registry-fra.oracle.com
To use this local registry with the Vagrant Kubernetes cluster, define in the Kubernetes Vagrantfile:
KUBE_REPO = "192.168.99.253:5000"
KUBE_PREFIX = "/kubernetes"
KUBE_LOGIN = false
KUBE_SSL = false
With our local registry there is no need anymore to provide
credentials when installing Kubernetes.
Vagrant provisioning script will also run the kubeadm-setup-master.sh
/
kubeadm-setup-worker.sh
scripts. In other words, your Kubernetes
cluster will be fully operational after a vagrant up
!
When installed, this Vagrant project will make use of the following third party Vagrant plugins:
- vagrant-env: loads environment variables from .env files;
- vagrant-proxyconf: set proxies in the guest VMs if you need to access the Internet through proxy. See plugin documentation for the configuration.
To install Vagrant plugins run:
vagrant plugin install <name>...
Please provide feedback of any kind via Github issues on this repository.