☰ 분류

Python 개발 컨테이너 프롬프트

프로젝트 루트에서 사용할 Docker 기반 Python 개발 컨테이너를 만들기 위해 pull, run 명령과 VS Code 연결 방법을 제공합니다.

분류개발 › 배포·운영
태그초안작성개발자코드
프롬프트 (영어 본문 · 답은 한국어로 옵니다)
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:
1. The docker pull command (if needed).
2. The full docker run command with all flags.
3. 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.

어떤 프롬프트인가

VS Code Remote Containers에 붙일 Python slim-bookworm 컨테이너를 실행할 때 쓰는 DevOps 프롬프트다. 호스트 파일 생성 없이 비root vscode 사용자와 작업 폴더 마운트를 요구한다.

모델 비교

Gemini가 가장 구체적이나 권한 처리가 아쉽다. ChatGPT는 이미지 태그 오류가 치명적이며 [C]는 누락됐다.

Gemini종합 1위
38/ 50

+ 플래그 설명과 VS Code 연결 안내가 구체적이다.

- 바인드 마운트 전체 chown과 실제 사용자 설정이 위험하다.

ChatGPT
35/ 50

+ 요구 명령과 연결 절차를 간결하게 정리했다.

- 존재하지 않을 가능성이 큰 이미지 태그를 사용했다.

기준ChatGPTGemini앞선 모델
지시 준수67Gemini +17%
정확성36Gemini +100%
구체성89Gemini +13%
구성·가독성99동점
분량 적정성97ChatGPT +29%

gpt-5.6-sol가 모델 이름을 가린 채 1~10점으로 채점했습니다 (2026-09-25). 측정값이 아니라 AI 심사 결과입니다.

답 전문 보기

같은 입력을 세 모델에 넣어 받은 답을 그대로 옮겼습니다. 각 CLI(에이전트 하네스)에서 실행했습니다. ChatGPT·Claude 앱이나 웹에서는 답이 다를 수 있습니다.

gpt-5.6-luna (codex CLI · 에이전트 하네스) · 실행일 2026-09-24

아래 명령은 컨테이너를 생성한 뒤 필요한 도구를 설치하고, 최종 프로세스를 UID 1000의 vscode 사용자로 실행합니다.

docker pull python:latest-slim-bookworm
docker run -dit \
  --name py-dev-container \
  --user root \
  --workdir /workspace \
  --volume "$(pwd):/workspace:rw" \
  python:latest-slim-bookworm \
  bash -lc '
    set -eux
    apt-get update
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      git curl ca-certificates build-essential
    useradd --uid 1000 --create-home --shell /bin/bash vscode 2>/dev/null || true
    exec su -s /bin/bash vscode -c "cd /workspace && exec bash -lc '\''sleep infinity'\''"
  '

--user root는 최초 실행 시 vscode 계정과 개발 도구를 생성하기 위한 부트스트랩 용도이며, 실제 계속 실행되는 프로세스는 vscode(UID 1000)입니다. --rm을 사용하지 않았으므로 컨테이너는 삭제되지 않습니다.

VS Code에서 연결하려면:

  1. VS Code 확장 기능에서 Dev Containers를 설치합니다.
  2. Cmd/Ctrl+Shift+P를 누릅니다.
  3. Dev Containers: Attach to Running Container... 를 선택합니다.
  4. py-dev-container를 선택합니다.
  5. 연결 후 /workspace에서 Python 프로젝트를 개발하면 됩니다.

컨테이너 상태 확인:

docker ps

중지하려면:

docker stop py-dev-container

현재 실행 환경에서는 Docker 데몬에 직접 명령을 실행할 수 없어 실제 컨테이너 생성 결과까지는 확인하지 못했습니다.

같은 분류의 프롬프트

프로덕션 AI 에이전트 설계 프롬프트
AI 에이전트 보안 점검 프롬프트
AI 제공자 요금 조사 프롬프트
상자 탈출 AI 역할을 맡기는 프롬프트
보안 경고 분석 프롬프트