ID 로 Docker Swarm config 삭제
이 단계에서는 ID 를 사용하여 Docker Swarm config 를 제거하는 방법을 배웁니다. 이름으로 제거하는 것이 더 편리한 경우가 많지만, 유사한 이름을 가진 여러 config 가 있거나 어떤 config 를 제거하는지 확실히 알아야 할 때는 ID 로 제거하는 것이 유용합니다.
먼저, ID 로 제거할 config 를 만들기 위해 다른 config 를 생성해 보겠습니다. another_config.txt라는 파일을 만들고, 이를 기반으로 config 를 생성합니다.
echo "This is another sample configuration data." > ~/project/another_config.txt
docker config create another_app_config ~/project/another_config.txt
이제 another_app_config의 ID 를 얻기 위해 configs 를 나열합니다.
docker config ls
출력에서 another_app_config를 찾고 ID 를 기록해 둡니다. ID 는 문자열로 표시됩니다.
ID 로 Docker Swarm config 를 제거하려면 docker config rm 명령 다음에 config 의 ID 를 사용합니다. 구문은 docker config rm <config_id>입니다.
<config_id>를 이전 명령의 출력에서 기록한 실제 ID 로 바꿉니다.
docker config rm <config_id>
예를 들어, ID 가 abcdef123456인 경우 명령은 다음과 같습니다.
docker config rm abcdef123456
제거된 config 의 ID 가 출력에 표시되어 제거되었음을 확인합니다.
마지막으로, another_app_config가 더 이상 없는지 확인하기 위해 configs 를 다시 나열합니다.
docker config ls