Note: This lab is part of a series of labs for Mastering Container Offers Workshop. You must finish this lab before moving on to the next sections.
In this lab, you will pull the CNAB bundler image and use it to create a CNAB bundle from the files you've prepared.
About the Microsoft CNAB image
The Microsoft CNAB Docker image contains all the tools needed to turn the files you've created into a CNAB bundle. This image exists because the opensource CNAB standards are changing frequently and this image is kept up to date with the latest tools to enable you to build a CNAB bundle without all of the manual steps needed.
Open terminal and run the following command to download Microsoft's CNAB builder image.
docker pull mcr.microsoft.com/container-package-app:latest
-
You'll now start the the CNAB container in interactive mode, sharing a volume. Provide the full path to your
container-labs
directory where indicated.Below is an example of this command.
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v /mnt/c/Users/david/projects/container-labs:/data --entrypoint "/bin/bash" mcr.microsoft.com/container-package-app:latest
The following is a template for the command to run. Replace [path to container-labs] with your complete path from the root of your drive.
docker run -it -v /var/run/docker.sock:/var/run/docker.sock -v [path to container-labs]:/data --entrypoint "/bin/bash" mcr.microsoft.com/container-package-app:latest
After the container starts, you will be on the command line in the
container-package-app
container itself. Commands executed here will run within the container. -
Run the following command to enter the shared volume.
cd data
-
Run the following to go into the
container-package
folder.cd container-package
-
Run the following command to validate all files going into creating the CNAB bundle. Fix any issues indicated by the tool.
cpa verify
-
If not logged into Azure, run the following command to login. Follow the instructions given on the command line.
az login
-
Log in to your ACR.
az acr login -n <ACR Server> -u <ACR Admin> -p <ACR password>
-
Run the following command in the container terminal to start building the CNAB bundle and push it to the ACR you defined in the manifest file.
cpa buildbundle
cpa buildbundle
command may take some time to complete.
When you see output similar to that shown in the below image, the command has completed.
Now that the CNAB bundle has been built, you'll ensure it is in place in your ACR.
-
Log into Azure Portal
-
Open your ACR resource
-
Click on Services > Repositories
-
You will see the repository.
com.nonmicrosoft.azuretodoapptest
-
Click on
com.nonmicrosoft.azuretodoapptest
bundle. -
Click the
1.0.0
tag to inspect Artifact reference and manifest for that CNAB bundle.
Congratulations! You have created and uploaded a CNAB bundle. You have also finished this lab.