Docker

[Docker]error: version in "./docker-compose.yaml" is unsupported. you might be seeing this error because you're using the wrong compose file version. either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `s..

easysheep 2023. 11. 24. 14:32

0. 발생 

airflow docker-compose를 진행 중에 다음과 같은 오류가 발생 하였다.  

error: version in "./docker-compose.yaml" is unsupported. you might be seeing this error because you're using the wrong compose file version. either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1.

https://stackoverflow.com/questions/49839028/how-to-upgrade-docker-compose-to-latest-version

 

How to upgrade docker-compose to latest version

I have installed docker-compose using the command sudo apt install docker-compose It installed docker-compose version 1.8.0 and build unknown I need the latest version of docker-compose or at le...

stackoverflow.com

1. 원인

docker-compose version이 1.23으로 해당 컴포즈 파일을 지원하지 않았고 최신 도커 컴포즈를 설치 해야 했다.

2. 구 버전 제거

설치 했던 방법에 맞추어 제거

# apt-get docker-compose 설치시
sudo apt-get remove docker-compose

# curl
sudo rm /usr/local/bin/docker-compose

# pip
pip uninstall docker-compose

3. 새로운 버전 설치 

#최신 버전 저장
VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | grep -Po '"tag_name": "\K.*\d')
#설치 경로 지정
DESTINATION=/usr/local/bin/docker-compose
# 설치
sudo curl -L https://github.com/docker/compose/releases/download/${VERSION}/docker-compose-$(uname -s)-$(uname -m) -o $DESTINATION
# 설치 경로의 권한 설정
sudo chmod 755 $DESTINATION
# 버전 확인 
docker-compose -v