This document outlines the steps for deploying a basic utility service in OpenShift using the oc command-line tool and Docker images.
This script creates a deployment for a service named utilities with the following functionalities:
- Runs the
fedora:latestDocker image. - Installs essential utilities like
nc,wget,curl,bind-utils,iputils,net-tools, andtelnet. - Runs
openldap-clientsto enable LDAP server access. - Keeps the container running indefinitely by executing
sleep 10000as the command.
This is a basic example and can be customized with different tools and functionalities.
- Building the Docker Image:
oc new-build --strategy docker --docker-image fedora:latest --name utilities -l app=utilities -D $'FROM fedora:latest\nRUN yum install -y nc wget curl bind-utils iputils net-tools telnet openldap-clients iproute nfs-utils\nCMD ["sleep", "10000"]'
oc new-build: Creates a new build configuration.--strategy docker: Specifies Docker as the build strategy.--image fedora:latest: Defines the base image for the build.--name utilities: Names the build configuration.-l app=utilities: Adds a label to the build for identification.-D: Injects the Dockerfile content directly.FROM fedora:latest: Starts the Dockerfile with thefedora:latestimage.RUN yum install -y ...: Installs the specified utilities within the container.CMD ["sleep", "10000"]: Runssleep 10000to keep the container alive.
- Deploying the Service:
oc new-app utilities:latest
oc new-app: Creates a new deployment from the built image.utilities:latest: Specifies the image name and tag (latest) for deployment.
This command will deploy the utilities service in OpenShift. You can access the service logs, view container details, and manage its lifecycle using the oc command or the OpenShift web console.
- This example uses a publicly available Docker image (
fedora:latest) for simplicity. You can replace it with a private image repository if needed. - The
sleep 10000command keeps the container running. You can replace it with the actual service command or application to run. - This documentation serves as a basic guide. Consider exploring additional OpenShift features and configurations for more advanced deployments.
Feel free to customize and expand this script to fulfill your specific needs for utility services in OpenShift.
oc new-project utli
oc new-build --strategy docker --image fedora:latest --name utilities -l app=utilities -D $'FROM fedora:latest\nRUN yum install -y nc wget curl bind-utils iputils net-tools telnet openldap-clients iproute nfs-utils\nCMD ["sleep", "10000"]'
oc new-app utilities