Build and Push your Image to Nexus
Objectives
- Push artifacts to Nexus Registry hosted on Stakater App Agility Platform (SAAP).
Key Results
- Image built and pushed to image repository
Guide
Build the Image
-
Run the following command to build the image.
buildah bud --format=docker --tls-verify=false --no-cache-f ./Dockerfile -t <nexus-docker-reg-url>/<app-name>:1.0.0 .
-
Run the following command to run the image.
# -p flag exposes container port 8080 on your local port8080 buildah run <nexus-docker-reg-url>/<app-name>:1.0.0 .
Login to Image Registry
-
Find the Image registry URL here or Navigate to the cluster Forecastle, search
nexus
using the search bar on top menu and copy the nexus url.nexus-docker-reg-url
: Removehttps://
from the start and add-docker
in URL afternexus
. This URL points to Docker Registry referred asnexus-docker-reg-url
in this tutorial for examplenexus-docker-stakater-nexus.apps.clustername.random123string.kubeapp.cloud
.
-
Run following command to log into the registry. > Make sure to get credentials from Stakater Admin.
buildah login <nexus-docker-reg-url>
Push Docker Image to Nexus
-
Replace the placeholders and Run the following command inside application folder.
# Buldah Bud Info : https://manpages.ubuntu.com/manpages/impish/man1/buildah-bud.1.html buildah bud --format=docker --tls-verify=false --no-cache -f ./Dockerfile -t <nexus-docker-reg-url>/<app-name>:1.0.0 .
-
Lets push the image to nexus docker repo.
# Buildah push Info https://manpages.ubuntu.com/manpages/impish/man1/buildah-push.1.html buildah push <nexus-docker-reg-url>/<app-name>:1.0.0 docker://<nexus-docker-reg-url>/<tenant-name>/<app-name>:1.0.0
Verify Image Available
- Open Nexus UI from Forecastle. Upon opening the link, you'll be redirected to Nexus home page.
- Select
Browse
from the left sidebar, Click ondocker
to view your Container Image Registry.
-
Verify that the image you pushed is present in the list.