Creating the Db2 tutorial workspace in Docker Desktop
Learn how to create the workspace for the z/OS® Connect Designer Db2® API project in Docker Desktop.
Before you begin
- Downloading the z/OS Connect Designer image.
- Downloading the z/OS Connect Designer Db2 sample
- Setting up Db2 native REST services
About this task
This topic is applicable to:Create the directories and files on your workstation that you need to create a z/OS Connect API project in z/OS Connect Designer.
- Create a project workspace directory. At the command prompt on your workstation, change to the directory where you want to create your z/OS Connect API project.Note: You can create the project workspace in any directory. For this tutorial, create the project workspace in the Desktop directory if you are using a Mac or the root directory if you are using Windows.
- Enter the following command. For Windows, enter
cd /.For MacOS, enter
- Enter the following command to create a project workspace directory called
- Enter the following command to change to that directory:
- In the ZCWorkspace directory, create the subdirectories for the
API project. These subdirectories are used for Liberty server configuration files. For Windows, enter the following command:
mkdir EmployeesApi\src\main\liberty\configFor MacOS, enter the following command:
mkdir -p EmployeesApi/src/main/liberty/config
- In the ZCWorkspace directory, create the
logs and certs subdirectories. Enter the following commands:
- Enter the following command.
- Verify that the z/OS Connect Designer image is loaded. Run the following command to list the available docker images on your workstation.
The following output shows that the z/OS Connect Designer image is now available.
docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE icr.io/zosconnect/ibm-zcon-designer 3.0.75 ffba75f49b73 7 hours ago 1.52GBNote: The creation timestamp shows when the image itself was first created, not when it was loaded onto your workstation.
- Create the docker-compose.yaml file. Open a new file in your text editor. Copy the contents in Figure 1 and save the file as docker-compose.yaml in the ZCWorkspace directory. Keep the file in the editor for the next step.
- Add your Db2 credentials to the
docker-compose.yaml file. The file contains the
environmentarray. This array contains environment variables that can be passed into the container at run time.
docker-compose.yamlfile as follows:
Figure 2 shows the updated
<db2username>with your username for connecting to Db2.
- Encrypt your password for connecting to Db2. Enter the following command, replacing <myPassword > with your own password:
docker run --rm icr.io/zosconnect/ibm-zcon-designer:3.0.75 securityUtility encode <myPassword> --encoding=aes
The output looks something like this:
<db2password>with in the docker-compose.yaml file with the encrypted password.
<db2host>with your hostname for the Db2 instance that you are connecting to.
<db2port>with the port number for the Db2 instance that you are connecting to.
At run time, these environment variables are used to create a Db2 Connection.
- Save and close the docker-compose.yaml file.
- Verify the structure of the files on your workstation in your project workspace
directory. On the command line, enter dir for Windows or ls for Mac. Verify that the new files and directories are listed correctly. The following screen image shows the expected project structure.
/ZCWorkspace |-- /certs |-- /logs |-- /EmployeesApi/src/main/liberty/config |-- docker-compose.yaml