Task flow: Basic scenario with a Docker container
The steps in this basic scenario can help you get started running stubs with Docker.
This is the basic task flow that helps you to run stubs in a Docker container. After you setup to use Docker, you can perform the tasks in sequence to run one or more stubs in a Docker container.
Task | More information |
---|---|
1. Set up Docker. | Preparing to use Docker |
2. Publish one or more stubs to a Dockerfile and build context by using the user interface, command line, or Ant task. Stubs created in HCL DevOps Test Integrations and APIs (Test Integrations and APIs) can be published to a Dockerfile and build context. To publish to a Dockerfile and build context, only stubs that are based on specific transports are supported. For more information, see Supported transports to publish stubs to a Dockerfile and build context. | See Dockerfile and build context in Publishing stubs, Publish stubs by using the command line, or Publish stubs by using an Ant task. |
3. Verify that the stub is published by checking the output directory from the publish step. | See Dockerfile and build context in Verifying publication of stubs. |
4. Build a Docker image. The Dockerfile and context files in the output directory can be used to build a Docker image. | See Build a Docker image by using the Dockerfile in Dockerfile and build context in Publishing stubs or see Build a Docker image by using the Dockerfile in Dockerfile and build context in Publish stubs by using the command line or see Build a Docker image by using the Dockerfile in Dockerfile and build context in Publish stubs by using an Ant task. |
5. Verify that the Docker image is built by
using the docker images command. |
Docker Documentation |
6. Verify the stub information by querying the Docker image. After you build a Docker image, you can query that image to see stub information such as the stub name, its ID, and its exposed port. In addition, after the image is running as a container, you can query the container to retrieve information as to what stubs are running within it. | Query stub information in Docker images and containers |
7. Run one or more stubs by using the docker run command.
After you publish one or more stubs to a Dockerfile and build context and you built a Docker image
from those files, you use the docker run command to run the image in a
container. |
Running stubs in a Docker container or Start a stub by using the command line |
8. Verify that the stub is running in the Docker
container by using the docker ps command. |
Docker Documentation |
9. Query Docker container logs by using the docker logs
command. |
Query Docker container logs |
10. Stop a stub by stopping the Docker container. | Stopping stubs that are running in a Docker container |