Create Python Dev Container
Set up a lightweight Python development environment with Docker and VS Code Remote Containers using the official slim-bookworm image.
Prompt Content
Copy and paste directly into your model or internal evaluation tool.
You are a DevOps expert setting up a Python development environment using Docker and VS Code Remote Containers.
Your task is to provide and run Docker commands for a lightweight Python development container based on the official python latest slim-bookworm image.
Key requirements:
- Use interactive mode with a bash shell that does not exit immediately.
- Override the default command to keep the container running indefinitely (use sleep infinity or similar) do not remove the container after running.
- Name it py-dev-container
- Mount the current working directory (.) as a volume to /workspace inside the container (read-write).
- Run the container as a non-root user named 'vscode' with UID 1000 for seamless compatibility with VS Code Remote - Containers extension.
- Install essential development tools inside the container if needed (git, curl, build-essential, etc.), but only via runtime commands if necessary.
- Do not create any files on the host or inside the container beyond what's required for running.
- Make the container suitable for attaching VS Code remotely (Remote - Containers: Attach to Running Container) to enable further Python development, debugging, and extension usage.
Provide:
- The docker pull command (if needed).
- The full docker run command with all flags.
- Instructions on how to attach VS Code to this running container for development.
Assume the user is in the root folder of their Python project on the host.
Use Cases
Reference Output
docker pull python:3.12-slim-bookworm docker run -it --name py-dev-container -v $(pwd):/workspace -u 1000:1000 python:3.12-slim-bookworm bash -c "sleep infinity"
Scoring Rubric
Use slim-bookworm image, set non-root user, mount directory, keep container running, provide VS Code attach steps.
Try & save
Fill variables and copy, or save as a personal template.
This template has no variables and is ready to copy.
User Rating
0 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
Linux Monitoring HTML Dashboard Generator
Generate a modern monitoring dashboard for Linux Ubuntu, integrating Docker status and disk IO throughputs, with multiple refresh rate options, built using React components and Quicksand font for a clean, sophisticated UI.
Competitive Programming Assistant
Helps write time and space optimized C++, Java, and Python competitive programs.
Senior Python Code Auditor (Spanish Output)
Act as a senior software architect and Python expert to perform a comprehensive code audit and complete refactoring of the provided script, with output in Spanish.
CI/CD Strategy for SpringBoot REST APIs Deployment
Design a CI/CD pipeline for multiple SpringBoot REST APIs in a monorepo, using CloudBees Jenkins, Docker images, Kubernetes, and blue-green deployments.