1. 개요

2. 발단

아래와 같이 apt로 설치를 했는데 버전이 좀 예전 버전이다.

$ sudo apt install docker-compose
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  golang-docker-credential-helpers libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsecret-1-0 libsecret-common python python-asn1crypto python-backports.ssl-match-hostname
  python-cached-property python-certifi python-cffi-backend python-chardet python-cryptography python-docker python-dockerpty python-dockerpycreds python-docopt python-enum34 python-funcsigs
  python-functools32 python-idna python-ipaddress python-jsonschema python-minimal python-mock python-openssl python-pbr python-pkg-resources python-requests python-six python-texttable python-urllib3
  python-websocket python-yaml python2.7 python2.7-minimal
Suggested packages:
  python-doc python-tk python-cryptography-doc python-cryptography-vectors python-enum34-doc python-funcsigs-doc python-mock-doc python-openssl-doc python-openssl-dbg python-setuptools python-socks
  python-ntlm python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
  docker-compose golang-docker-credential-helpers libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsecret-1-0 libsecret-common python python-asn1crypto python-backports.ssl-match-hostname
  python-cached-property python-certifi python-cffi-backend python-chardet python-cryptography python-docker python-dockerpty python-dockerpycreds python-docopt python-enum34 python-funcsigs
  python-functools32 python-idna python-ipaddress python-jsonschema python-minimal python-mock python-openssl python-pbr python-pkg-resources python-requests python-six python-texttable python-urllib3
  python-websocket python-yaml python2.7 python2.7-minimal
0 upgraded, 38 newly installed, 0 to remove and 43 not upgraded.
Need to get 6004 kB of archives.
After this operation, 26.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
 

버전이 이렇다.

$ docker-compose  -v
docker-compose version 1.17.1, build unknown

3. 최신 버전 설치

일단 구 버전을 지운다.

$ sudo apt-get remove docker-compose
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  golang-docker-credential-helpers libpython-stdlib libpython2.7-minimal libpython2.7-stdlib libsecret-1-0 libsecret-common python python-asn1crypto python-backports.ssl-match-hostname
  python-cached-property python-certifi python-cffi-backend python-chardet python-cryptography python-docker python-dockerpty python-dockerpycreds python-docopt python-enum34 python-funcsigs
  python-functools32 python-idna python-ipaddress python-jsonschema python-minimal python-mock python-openssl python-pbr python-pkg-resources python-requests python-six python-texttable python-urllib3
  python-websocket python-yaml python2.7 python2.7-minimal
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  docker-compose
0 upgraded, 0 newly installed, 1 to remove and 43 not upgraded.
After this operation, 517 kB disk space will be freed.
Do you want to continue? [Y/n] y

다음 단계를 진행하다. 만약 jq 에러가 나면 jq를 설치하고 재시도한다.

$ VERSION=$(curl --silent https://api.github.com/repos/docker/compose/releases/latest | jq .name -r)

버전이 확인되었으면 아래처럼 설치한다.

$ 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

설치는 /usr/local/bin에 된다. 버전 확인.

$ docker-compose -v
docker-compose version 1.24.1, build 4667896b