Cara Upgrade dan Instalasi Docker Compose ( Error: Version in "./docker-compose.yml" is unsupported )

Ane mau buat images project dan gagal. Langkah awalnya ane clone project lalu eksekusi docker-compose build web , malah keluar error kaya gini :
# docker-compose build web
ERROR: Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a version of "2" (or "2.0") 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.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/
Perasaan udah support antara versi file docker-compose.yml dengan versi docker engine. Ternyata ga support dengan versi docker-composenya hehe.
# docker-compose -v
docker-compose version 1.8.0, build unknown
Sedangkan versi di project versi 2.1 dan 2.3
Maka menurut web resmi dockernya seperti ini :
An upgrade of version 2.2 that introduces new parameters only
available with Docker Engine version 17.06.0+. Version 2.3 files are
supported by Compose 1.16.0+.
Nah ini caranya upgrade docker compose :
  1. Hapus dulu instalan yang dulu dengan perintah 
    # sudo apt-get remove docker-compose
  2. Setelah dihapus ketikan perintah
    # sudo curl -L "https://github.com/docker/compose/releases/download/1.16.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
    Perintah 1.16.0 bisa diganti dengan versi yang diinginkan. Karena disini ane butuhnya versi 1.16.0
  3. Lalu
    # sudo chmod +x /usr/local/bin/docker-compose
    # sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
    
  4. Cek versi dengan perintah :
    # docker-compose -v
    docker-compose version 1.16.0, build ea60ca1
    
Berarti tandanya docker compose berhasil di update.
Oke semoga berhasil !


Posting Komentar

0 Komentar