여러 Docker endpoint를 이름으로 저장하고 전환하는 docker context 관리 그룹.
use 는 기본 context를 바꾸고, top-level –context 옵션은 1회성 오버라이드다.docker context COMMAND
create: 새 context 생성–docker host=ssh://user@host, –description, –fromls: context 목록 조회–format, -qshow: 현재 기본 context 이름 출력use: 기본 context 변경inspect: endpoint와 metadata 확인-fupdate: 기존 context endpoint 수정export: tar archive로 내보내기import: tar 또는 zip에서 가져오기rm: context 삭제# SSH endpoint를 context로 등록 docker context create prod --docker host=ssh://deploy@example.com # 현재 기본 context 확인 및 전환 docker context show docker context use prod # 1회성으로만 다른 context 사용 docker --context prod ps
use 를 바꾸면 이후 기본 명령 대상이 달라진다. 운영 사고 방지를 위해 프롬프트나 쉘 alias에 현재 context를 표시하는 경우가 많다.–context 로 명시하는 편이 안전하다.Usage: docker context COMMAND Manage contexts Commands: create Create a context export Export a context to a tar archive FILE or a tar stream on STDOUT. import Import a context from a tar or zip file inspect Display detailed information on one or more contexts ls List contexts rm Remove one or more contexts show Print the name of the current context update Update a context use Set the default docker context Run 'docker context COMMAND --help' for more information on a command.
+