Testing the Development Environment with Podman¶
1. Testing the Dockerfile with podman build¶
Run the following command inside ${workspace}\.devcontainer to build the container:
podman build -t mkdocs-devcontainer .
This will build the container image using your .devcontainer/Dockerfile. Since podman is compatible with docker, no changes to the Dockerfile are required.
2. Testing the Environment with podman run¶
Run the following command to start the container:
podman run -it --rm mkdocs-devcontainer
This will start the container and drop you into a bash shell. From there, you can test:
- Python: Run
python3 --versionto verify Python is installed. - Conda: Run
conda --versionto verify Conda is installed. - MkDocs: Run
mkdocs --versionto verify MkDocs is installed. - mkdocs-material: Run
pip show mkdocs-materialto verify
3. Using the Devcontainer in Windows Terminal App¶
a. Configure Podman Socket¶
- Ensure the
podmansocket is running:
podman system service --time=0
- Set the
DOCKER_HOSTenvironment variable to point to thepodmansocket:
export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock
This allows tools like Visual Studio Code to communicate with podman.
b. Open the Devcontainer in VS Code¶
- Open your workspace in Visual Studio Code.
- Install the "Remote - Containers" extension if not already installed.
- Use the "Remote - Containers: Reopen in Container" command from the Command Palette.
- VS Code will use the
podmanruntime to build and run the devcontainer.
c. Windows Terminal Integration¶
You can open a new tab in the Windows Terminal App and connect to the running container using:
podman exec -it <container-id> bash
Replace <container-id> with the ID of the running container, which you can find using podman ps.
4. Potential Issues¶
- Rootless Podman: If you are using rootless
podman, ensure that your user has the necessary permissions to run containers and bind the socket. - Volume Mounts: If you need to mount your workspace into the container, use the
-vflag withpodman run:
podman run -it --rm -v $(pwd):/workspace mkdocs-devcontainer
- Windows File Paths: When using
podmanon Windows, ensure that file paths are correctly translated (e.g.,/mnt/c/...for Windows drives).
5. Testing the Devcontainer¶
Once the container is running, verify:
- The
mkdocsenvironment is created and activated:
conda activate mkdocs
- You can build documentation using
mkdocs:
mkdocs serve
With these steps, you should be able to use your devcontainer seamlessly in the Windows Terminal App.