Gordon 사용 사례와 예시
Gordon 사용 사례와 예시
Gordon은 자연어 대화로 Docker 워크플로를 처리해요. Docker Desktop에서는 사이드바에서 열린 세션을 위한 Gordon을, Containers, Images, Builds, Volumes 같은 뷰의 상황별 진입점에서도 Gordon을 사용할 수 있어요.
출처: 문서
본문
요구 사항: Docker Desktop 4.74.0 이상
이러한 뷰 중 하나에서 Gordon을 선택하면 현재 보고 있는 항목에 대한 컨텍스트가 미리 채워진 대화가 열려요. CLI에서는 docker ai로 같은 질문을 할 수 있어요.
실패한 컨테이너 디버깅
Containers 뷰에 있는데 컨테이너가 충돌했거나 예상과 다르게 동작한다고 해 볼게요. 컨테이너 행에서 Gordon을 열어 그 컨테이너의 상태와 설정을 물어볼 수 있어요:
- "Why did this container exit?"
- "What environment variables are set in this container?"
- "How long did this container run?"
- "What security settings are applied to this container?"
CLI에서는:
$ docker ai "why is my postgres container crashing on startup?"
실패한 빌드 디버깅
Builds 뷰에서 실패했거나 예상보다 느린 빌드를 보고 있다면, 빌드에서 Gordon을 열어 Dockerfile, 빌드 인자, 캐시 동작을 확인할 수 있어요:
- "Why did this build fail?"
- "How can I improve cache usage for this build?"
- "What Dockerfile instructions were used?"
- "What build arguments were used?"
CLI에서는:
$ docker ai "my build is failing at the pip install step, what's wrong?"
이미지 검사
Images 뷰에서 실행하기 전에 이미지 안에 무엇이 있는지 이해하고 싶거나, 기본 이미지의 크기를 파악하고 싶다면:
- "How do I run this image in the CLI?"
- "What environment variables are configured?"
- "What entrypoint is configured?"
- "What's the base architecture of this image?"
- "Is there a lighter version of this image?"
CLI에서는:
$ docker ai "compare my python:3.12 image to python:3.12-slim"
볼륨과 리소스 관리
Volumes 뷰에서 저장된 내용, 볼륨을 사용하는 컨테이너, 정리 방법을 물어볼 수 있어요. 어떤 뷰에서든 Gordon 사이드바를 사용해 더 넓은 환경을 조사할 수 있어요:
- "Which containers are using this volume?"
- "Show me all my containers and their status"
- "How much disk space is Docker using?"
- "List my images sorted by size"
CLI에서는:
$ docker ai "clean up all unused Docker resources"
빌드와 컨테이너화
새 프로젝트에서는 Gordon 사이드바에서 대화를 시작하거나 프로젝트 디렉터리에서 docker ai를 실행하면 돼요. Gordon이 작업 디렉터리를 읽고 적절한 파일을 제안해 줘요:
- "Containerize my Node.js app"
- "Create a docker-compose for my stack"
- "Set up a dev environment with Postgres and Redis"
CLI에서는:
$ cd ~/my-project
$ docker ai "create a Dockerfile for this application"
개발과 최적화
이미 빌드한 이미지라면 Images 뷰에서, 프로젝트 컨텍스트가 있다면 Gordon 사이드바에서 시작할 수 있어요:
- "Optimize this Dockerfile"
- "Add a health check to my service"
- "Make my Dockerfile more secure"
CLI에서는:
$ docker ai "rate my Dockerfile and suggest improvements"
Docker 배우기
개념적인 질문은 Gordon 사이드바나 CLI를 사용해요. Gordon은 일반적인 답변이 아니라 여러분의 환경에 근거한 개념을 설명해 줘요:
- "What is a Docker volume?"
- "Explain multi-stage builds"
- "How does networking work in Docker?"
CLI에서는:
$ docker ai "what's the difference between COPY and ADD in a Dockerfile?"
효과적인 프롬프트 작성
구체적으로 작성하세요:
- 관련 컨텍스트를 포함하세요: "the database"가 아니라 "my postgres container"
- 목표를 밝히세요: "optimize"가 아니라 "make my build faster"
- 디버깅할 때는 오류 메시지를 포함하세요
Gordon은 "어떻게 하는지"보다 "무엇을 달성하고 싶은지"를 설명할 때 가장 잘 동작해요. Gordon은 대화 전체에서 컨텍스트를 유지하므로, 반복하지 않고 후속 질문이나 관련 질문으로 이어갈 수 있어요.
작업 디렉터리 컨텍스트
CLI에서 docker ai를 사용할 때 Gordon은 현재 작업 디렉터리를 파일 작업의 기본 컨텍스트로 사용해요. Gordon을 시작하기 전에 프로젝트 디렉터리로 이동해 올바른 파일에 접근할 수 있게 해 주세요:
$ cd ~/my-project
$ docker ai "review my Dockerfile"
작업 디렉터리는 -C 플래그로 덮어쓸 수도 있어요. 자세한 내용은 CLI로 Gordon 사용하기 문서를 참고해 주세요.