Importing certificates from a local JSON file
If your internal or third party certificates are not stored in a remote configuration management center such as Vault, then we can also define the certificates locally in a JSON file. We can create a custom Docker image and copy the JSON file into the /SETUP/certs/custom directory of the Docker image.Importing the local certificates from the JSON file into your running Docker container are handled by the /SETUP/bin/updateLocaCerts.sh script included in all the IBM provided Docker containers. The updateLocalCerts.sh script looks in the /SETUP/certs/custom directory and loads all JSON files. Here is an example of a certificate stored in JSON format and the mandatory name-value pairs.
{ "certificate": "-----BEGIN CERTIFICATE-----\nMIIETDCCAjSgAwIBAgIUTrvpjzgpyt6L9AWj2E0W4ps2woswDQYJKoZIhvcNAQEL\nBQAwKzEpMCcGA1UEAwwgc2VsZnNlcnZlX3Byb2R1Y3Rpb25fcGtpIFJvb3QgQ0Ew\nHhcNMTcwOTI2MDQ1NzM3WhcNMTcxMTIxMDQ1ODA3WjAPMQ0wCwYDVQQDEwR0ZXN0\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtuWgQ5P9KjpgplOyejAE\nj5pDgSmQ6mZkbqY6gnIIKlw1I4Vulaigmeiir37NcAHtLA9HrpqafKoQqt3RPIFq\nMq2qb728JUNqdkmgp1QRnXdRVqrvGxT3o6XLMmxpkniwL+f3A/qFzuBgDJVltKLn\n1e0O3conPiiGtqaZ70+1lccKkKviLoin13T+27gFFws6dT74znCxT8c/ikXGMja1\nTDEddd+qkXlo4At104Fo7Uhx95JWorSljSTaCQkEeOjX+8SJHkARSrKeGEvkBESp\nXD23oUY9MlxGQnldioLAI5Eu8fRo3PKQUhuFnuoxTr0pO7R60AEe8E0sVU/cE3Ut\nswIDAQABo4GDMIGAMA4GA1UdDwEB/wQEAwIDqDAdBgNVHSUEFjAUBggrBgEFBQcD\nAQYIKwYBBQUHAwIwHQYDVR0OBBYEFLfcxphP+aSe61Mdi8IDP7bBvGXdMB8GA1Ud\nIwQYMBaAFA2X7xP+NiXXNXhJy3UQqocENxRTMA8GA1UdEQQIMAaCBHRlc3QwDQYJ\n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_host": "desthost" }
How do I load the JSON files to the /SETUP/certs/custom directory?
- We can use the COPY instruction in a Dockerfile to create a new Docker image and copy the JSON files to the /SETUP/certs/custom directory. For example, the following Dockerfile copies a certs.json file to the /SETUP/certs/custom directory.
FROM <Docker_registry>/commerce/crs-app:<source_image_tag> COPY certs.json /SETUP/certs/custom
We can customize the WCB utility to package your JSON files into the output customization package. Then, when you build a new Docker image with our customization package, the /SETUP/bin/applyCustomization.sh script automatically puts your JSON files into the /SETUP/certs/custom directory. See Customizing the WebSphere Commerce Build tool.
Related reference
Docker container start up logic
Docker container start up configuration parameters
Environment data structure in Consul/Vault