Etc

[docker] docker compose vs docker-compose

voidtype 2023. 7. 12. 17:35

개요

docker-compose를 사용해야할 일이 있었는데요,   command에 --profile 옵션을 사용하도록 되어있었습니다. 더구나 docker compose와 같이 하이픈이 없이 docker 명령어의 하위 커맨드로 사용하도록 되어있었습니다.

이번에 이 둘 차이를 확인해보고, --profile 옵션을 사용할 수 있는  docker-compose를 설치하는 방법을 간단히 메모해둡니다.

 

docker compose

공백으로 구분된 위 커맨드는 Docker desktop에서 처음 소개되었고, desktop에서만 사용할 수 있는 커맨드입니다. 과거 docker-compose를 go로 다시 개발하여  v2로 새롭게 릴리즈되었습니다.

 

docker-compose

파이썬 기반으로 작성된 원래 docker-compose 프로젝트 입니다. 아래 명령어를 통해서 설치/사용가능합니다.

$ curl -L "https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-$(uname -s)-$(uname -m)" -o ./docker-compose
./docker-compose --help
Usage:  docker compose [OPTIONS] COMMAND

Docker Compose

Options:
      --ansi string                Control when to print ANSI control characters ("never"|"always"|"auto") (default "auto")
      --compatibility              Run compose in backward compatibility mode
      --env-file string            Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the, first specified, Compose file)
  -p, --project-name string        Project name

v2버전으로 설치해야 --profile 옵션을 사용할 수 있습니다. 

v1버전은 이제 deprecated 된다고 하니, v2버전을 사용하시길 추천드립니다.

 

참고

https://stackoverflow.com/questions/66514436/difference-between-docker-compose-and-docker-compose