Skip to main content
Redhat Developers  Logo
  • Products

    Featured

    • Red Hat Enterprise Linux
      Red Hat Enterprise Linux Icon
    • Red Hat OpenShift AI
      Red Hat OpenShift AI
    • Red Hat Enterprise Linux AI
      Linux icon inside of a brain
    • Image mode for Red Hat Enterprise Linux
      RHEL image mode
    • Red Hat OpenShift
      Openshift icon
    • Red Hat Ansible Automation Platform
      Ansible icon
    • Red Hat Developer Hub
      Developer Hub
    • View All Red Hat Products
    • Linux

      • Red Hat Enterprise Linux
      • Image mode for Red Hat Enterprise Linux
      • Red Hat Universal Base Images (UBI)
    • Java runtimes & frameworks

      • JBoss Enterprise Application Platform
      • Red Hat build of OpenJDK
    • Kubernetes

      • Red Hat OpenShift
      • Microsoft Azure Red Hat OpenShift
      • Red Hat OpenShift Virtualization
      • Red Hat OpenShift Lightspeed
    • Integration & App Connectivity

      • Red Hat Build of Apache Camel
      • Red Hat Service Interconnect
      • Red Hat Connectivity Link
    • AI/ML

      • Red Hat OpenShift AI
      • Red Hat Enterprise Linux AI
    • Automation

      • Red Hat Ansible Automation Platform
      • Red Hat Ansible Lightspeed
    • Developer tools

      • Red Hat Trusted Software Supply Chain
      • Podman Desktop
      • Red Hat OpenShift Dev Spaces
    • Developer Sandbox

      Developer Sandbox
      Try Red Hat products and technologies without setup or configuration fees for 30 days with this shared Openshift and Kubernetes cluster.
    • Try at no cost
  • Technologies

    Featured

    • AI/ML
      AI/ML Icon
    • Linux
      Linux Icon
    • Kubernetes
      Cloud icon
    • Automation
      Automation Icon showing arrows moving in a circle around a gear
    • View All Technologies
    • Programming Languages & Frameworks

      • Java
      • Python
      • JavaScript
    • System Design & Architecture

      • Red Hat architecture and design patterns
      • Microservices
      • Event-Driven Architecture
      • Databases
    • Developer Productivity

      • Developer productivity
      • Developer Tools
      • GitOps
    • Secure Development & Architectures

      • Security
      • Secure coding
    • Platform Engineering

      • DevOps
      • DevSecOps
      • Ansible automation for applications and services
    • Automated Data Processing

      • AI/ML
      • Data Science
      • Apache Kafka on Kubernetes
      • View All Technologies
    • Start exploring in the Developer Sandbox for free

      sandbox graphic
      Try Red Hat's products and technologies without setup or configuration.
    • Try at no cost
  • Learn

    Featured

    • Kubernetes & Cloud Native
      Openshift icon
    • Linux
      Rhel icon
    • Automation
      Ansible cloud icon
    • Java
      Java icon
    • AI/ML
      AI/ML Icon
    • View All Learning Resources

    E-Books

    • GitOps Cookbook
    • Podman in Action
    • Kubernetes Operators
    • The Path to GitOps
    • View All E-books

    Cheat Sheets

    • Linux Commands
    • Bash Commands
    • Git
    • systemd Commands
    • View All Cheat Sheets

    Documentation

    • API Catalog
    • Product Documentation
    • Legacy Documentation
    • Red Hat Learning

      Learning image
      Boost your technical skills to expert-level with the help of interactive lessons offered by various Red Hat Learning programs.
    • Explore Red Hat Learning
  • Developer Sandbox

    Developer Sandbox

    • Access Red Hat’s products and technologies without setup or configuration, and start developing quicker than ever before with our new, no-cost sandbox environments.
    • Explore Developer Sandbox

    Featured Developer Sandbox activities

    • Get started with your Developer Sandbox
    • OpenShift virtualization and application modernization using the Developer Sandbox
    • Explore all Developer Sandbox activities

    Ready to start developing apps?

    • Try at no cost
  • Blog
  • Events
  • Videos

Using Podman Compose with Microcks: A cloud-native API mocking and testing tool

April 22, 2021
Nicolas Massé
Related topics:
ContainersKubernetesOpen source
Related products:
Developer ToolsPodman DesktopRed Hat OpenShift

Share:

    Microcks is a cloud-native API mocking and testing tool. It helps you cover your API's full lifecycle by taking your OpenAPI specifications and generating live mocks from them. It can also assert that your API implementation conforms to your OpenAPI specifications. You can deploy Microcks in a wide variety of cloud-native platforms, such as Kubernetes and Red Hat OpenShift. Developers who do not have corporate access to a cloud-native platform have used Docker Compose. Although Docker is still the most popular container option for software packaging and installation, Podman is gaining traction.

    Podman was advertised as a drop-in replacement for Docker. Advocates gave the impression that you could issue alias docker=podman and you would be good to go. The reality is more nuanced, and the community had to work to get proper docker-compose support in Microcks for Podman.

    This article discusses the barriers to getting Microcks to work with Podman and the design decisions we made to get around them. It includes a brief example of using Podman in rootless mode with Microcks.

    Supporting Podman in Microcks

    Podman presented a few design barriers, which the Microcks community had to work around. We'll discuss the barriers and how we worked around them, and what those decisions mean for developers using Podman with Microcks.

    Rootfull or rootless?

    Docker requires running a daemon as root, which observers have long criticized as insecure. Podman adopted a very different architecture: It involves no daemon at all and can run as root (rootfull mode) or as a regular user (rootless mode). Microcks supports Podman in either rootfull or rootless mode.

    Although rootless mode looks very appealing, it does not come without cost. Drawbacks include:

    • Containers have no IP address and no DNS aliases.
    • Port redirection is done in userspace, whereas rootfull mode uses iptables, which is faster.
    • The overlay storage is done in userspace with FUSE, which is slower than the traditional overlayFS mount.

    Still, unless you need high performance or a specific network setup, you can use rootless mode.

    DNS aliases: Still in the way

    Microcks needs proper DNS aliases in place to work properly. The main reason is that Microcks uses the OpenID Connect protocol for user authentication, which involves both user-facing interactions and server-to-server interactions.

    Combined with the quirks and limitations of the other software in the stack (Keycloak, Docker, Podman), this requirement explains why it has always been challenging to get Microcks running without tinkering with the Docker Compose configuration.

    To work around this issue, the community created a shell script that discovers the current machine IP address and hardcodes that address in the podman-compose file.

    To get DNS aliases working, you need to enable the dnsname plugin in the default podman network.

    Networking

    With the rootfull mode in Podman came another challenge: By default, containers can refer to other containers only by their IP addresses. This command re-creates the default podman network and enables the dnsname plugin:

    $ sudo podman network rm podman
    $ sudo podman network create --subnet 10.88.0.0/16 podman
    

    Using Podman Compose with Microcks

    Podman support might not look glorious as presented here, but the benefits of using Podman are worth the effort!

    The rootless mode is the easiest and safest way to get Microcks working with Podman Compose:

    $ git clone https://github.com/microcks/microcks.git
    $ cd microcks/install/podman-compose
    $ ./run-microcks.sh
    Running rootless containers...
    Discovered host IP address: 192.168.3.102
    
    Starting Microcks using podman-compose ...
    ------------------------------------------
    Stop it with:  podman-compose -f microcks.yml --transform_policy=identity stop
    Re-launch it with:  podman-compose -f microcks.yml --transform_policy=identity start
    Clean everything with:  podman-compose -f microcks.yml --transform_policy=identity down
    ------------------------------------------
    Go to https://localhost:8080 - first login with admin/123
    Having issues? Check you have changed microcks.yml to your platform
    
    using podman version: podman version 2.1.1
    podman run [...]

    Rootfull mode requires that you enable the dnsname plugin on the default podman network, as described earlier. Then, you would just run this script with sudo.

    Conclusion

    Getting Microcks to work with Podman was not particularly difficult. We hope this support will help you get started with using Microcks in corporate environments. Read the announcement on microcks.io for more details.

    Last updated: February 7, 2024

    Recent Posts

    • How to run a fraud detection AI model on RHEL CVMs

    • How we use software provenance at Red Hat

    • Alternatives to creating bootc images from scratch

    • How to update OpenStack Services on OpenShift

    • How to integrate vLLM inference into your macOS and iOS apps

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Products

    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform

    Build

    • Developer Sandbox
    • Developer Tools
    • Interactive Tutorials
    • API Catalog

    Quicklinks

    • Learning Resources
    • E-books
    • Cheat Sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site Status Dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Report a website issue