Installing and configuring the Go container image
Go is available as an image on the IBM Cloud Container Registry (icr.io) for use on z/OS in conjunction with the IBM z/OS Container Platform (zOSCP). If zOSCP is installed, Go can be utilized in a container instance.
Locate the entitlement memo
The entitlement memo is needed to access the entitlement key to download the Go container image from IBM Cloud Container Registry.
Perform the following instructions to locate the entitlement memo within a Shopz order:
- Select in Shopz after your order is ready for download.
- Click the Download link to open the Download page.
- Scroll to the Direct Publication links section and click
+ sign to expand it.
The free publications are included in your order. For example, the entitlement memo for 5655-GOZ is i1356733.pdf.
- Click the publication link to open the entitlement memo.
Procedure
To use Go in the container instance, create a Containerfile with the
following steps:
- Choose the version of z/OS and Go and the "latest" version is
recommended:
FROM golang:latest
- Set a base work directory within the container:
WORKDIR /app
- Build the Go application.
COPY *.go ./ RUN go build -o /<name of executable>
- Command to run on container
initialization:
CMD ["/<name of executable>"]
podman build -t <name of image> .
podman run --rm <name of image>
Note: The Go container images are signed. To verify
the signature, follow the instructions in this blog.
Acquire the Go container image
You can acquire the IBM Open Enterprise SDK for Go container image from the IBM Cloud Registry
(icr.io) with an entitlement key.
Perform the following instructions to acquire the image:
Note: The following skopeo and podman
commands assume the policy.json file allows images to be accepted from icr.io and stored to your private
registry. In addition, the SSL_CERT_FILE environment variable needs to be set.
See Set up TLS to securely connect to image registries for
details.
- Use the
skopeo
command to copy the IBM Open Enterprise SDK for Go image from IBM Cloud Registry to your private registry.
whereskopeo copy docker://icr.io/zoscp/golang:latest docker://registry/[directory] --src-creds iamapikey:<entitlement key> --dest-creds XX:XX
XX:XX
is the private local registry credential (user ID : password) andregistry
is the private local registry name. Alternatively, Podman could be used to pull the IBM Open Enterprise SDK for Go image. - Use Podman to copy the Go image locally from icr.io in your own images with
the following command:
If you have any issues copying or pulling the image from IBM Cloud Registry, open a case against the IBM z/OS Container Platform product with Program ID 5655-MC3.podman login –u iamapikey –p <entitlement key> docker://icr.io podman pull docker://icr.io/zoscp/golang:latest