Lab 9.7 - Manage images with The Source-to-Image (S2I)

1. Install docker

yum install -y yum-utils
yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io -y

systemctl start docker
systemctl enable docker
systemctl status docker

2. Install the S2I tool

curl -s https://api.github.com/repos/openshift/source-to-image/releases/latest \
  | grep browser_download_url \
  | grep linux-amd64 \
  | cut -d '"' -f 4 \
  | wget -qi -

tar xvf source-to-image*.gz
mv s2i /usr/local/bin

3. Build an image

s2i build https://github.com/misskecupbung/nginx-helloworld \
 centos/nginx-112-centos7 \
 nginx-helloworld

4. Build an application with S2I tool

oc new-app centos/nginx-112-centos7~https://github.com/misskecupbung/nginx-helloworld
oc get pods

5. Verify the builds

oc get build

6. Make the service accessible by creating a route to it

oc expose svc/nginx-helloworld

7. List the routes to view the host/port

oc get routes

8. Try to access the application from the laptop by the URL http://nginx-helloworld-s2i-images.apps.openshift.podX.io

Daftar Materi