Working with Docker containers in patterns
If you have the Docker Pattern Type installed and enabled on the system, a Docker container software component is available that provides support for using Docker containers and Docker images in patterns.
- Docker Private Registry pattern is deprecated in Version 2.3.3.4 and later. The same function can now be used from the Cloud Paks Docker Private Registry pattern by selecting in the Deploy page of the IBM® Cloud Pak System user interface.
- Since Docker Private Registry pattern is deprecated in Version 2.3.3.4 and later, the Docker configuration page under Pattern development is expected to be removed after the 2.3.3.4 release. This function is no longer supported. You must ignore the Docker Private Registry pattern function if you encounter it in 2.3.3.4 or later.
Specify the Docker image to use to create the Docker container in the Image attribute for the Docker container software component. Depending on your system's configuration, you can either reference images in the Docker Hub, images that were uploaded to a private Docker registry that runs on the system, or your own Docker Trusted Registry. You can also upload a .tar or .tar.gz file that contains an exported Docker image. After you select the Docker image, specify the environment variable names and values (in the Environment variables section), volume names and values (in the Volumes section), and container ports and values (in the Port Bindings section) for the selected Docker image.
container directory | host directory |
---|---|
/container1 | /container1 |
You can also use multiple Docker containers on separate virtual images in a single pattern. If there are multiple Docker containers in a pattern, you can link two Docker containers. For example, if one Docker container is running an application that requires a database and the other container is running a database server, you can link the two containers so that the application container can access information about the database container. To link two containers, hover over one of the containers until the blue circle turns orange. Select the circle, drag a connection to the second container until the container is highlighted, and then release.
container port | host port |
---|---|
80 | 8080 |
Endpoint | Port |
---|---|
myserver.mydomain.com/wp-admin | 8080 |
When you look at the Instance Details page for an instance that include a Docker container, you can see the details for the Docker daemon in the Middleware perspective. To view the Docker logs for a node in an instance, click the Log link in the VM Status column of the DockerDaemon row. The Log Viewer displays the logs for the node. The Docker logs are under . If you configured any log volumes for the middleware in the Log Volumes attribute for the software component, those logs are available on this page. For more information about managing instances that include a Docker container, see the Related Tasks.
The Docker runtime
is started with default security mode. If you want to connect to a
secure private Docker registry,
see the Docker documentation
for details on enhancing the Docker runtime
security mode. For example, one option is to add a certificate to host
/etc/pki/ca-trust/source/anchors, run the update-ca-trust command
on the Docker host virtual
machine, and then restart the virtual machine. If you want to connect
to a deployed default private Docker registry for
testing purposes, add --insecure-registry <registry_ip:port>
to
the configuration and restart the Docker host virtual
machine. For example, in /etc/sysconfig/docker,
add: OPTIONS=" --insecure-registry 172.18.173.132:5000 --insecure-registry
172.18.173.137:5000 --bip=10.20.42.1/24"