Install Ansible development tools on a container inside VS Code
The Dev Containers VS Code extension requires a .devcontainer file to store settings for your dev containers. You must use the Ansible extension to scaffold a config file for your dev container, and reopen your directory in a container in VS Code.
Before you begin
- You have installed a containerization platform, for example Podman, Podman Desktop, Docker, or Docker Desktop.
- You have a Red Hat login and you have logged in to the Red Hat registry at
registry.redhat.io. For information about logging in toregistry.redhat.io, see Authenticating with the Red Hat container registry. - You have installed VS Code.
- You have installed the Ansible extension in VS Code.
- You have installed the Microsoft Dev Containers extension in VS Code.
- If you are installing Ansible development tools on Windows, launch VS Code and connect to the WSL machine. Click the
Remote(
) icon. In the dropdown menu that appears, select the option to connect to the WSL machine.
About this task
Procedure
Results
When the directory reopens in a container, the Remote () status displays Dev Container: ansible-dev-container.
The base image for the container is a Universal Base Image Minimal (UBI Minimal) image that uses microdnf as a package manager. The dnf and yum package managers are not available in the container.
For information about using microdnf in containers based on UBI Minimal images, see Adding software in a minimal UBI container in the Red Hat Enterprise Linux Building, running, and managing containers guide.
