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.
- If you are on Windows, you have installed WSL2 and Podman Desktop as your containerization platform. For setup instructions, see Requirements for Ansible development tools on Windows.
- 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 Content from marketplace.visualstudio.com is not included.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.
If your organization's security policy prevents you from installing containerization software on your workstation, you cannot use this installation method. Instead, install Ansible development tools from an RPM package. For more information, see Install Ansible development tools from an RPM package.
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.
