๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Server/Docker

Docker-compose.yml: `version` is obsolete ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

by ๋ฆฌ์š”_ 2024. 8. 19.
๋ฐ˜์‘ํ˜•

Docker-compose.yml: `version` is obsolete

๐ŸŒŸ INDEX


Docker-compose.yml: `version` is obsolete

Docker-compose.yml: `version` is obsolete

ํ”„๋กœ์ ํŠธ ์—…๋ฐ์ดํŠธ ํ›„ ๋„์ปค์—์„œ ์žฌ๋นŒ๋“œ ํ•˜๋ ค๋‹ˆ ๊ฐ‘์ž๊ธฐ `version` is obsolete ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์˜€์Šต๋‹ˆ๋‹ค.

์ง€๋‚œ์ฃผ ๊ธˆ์š”์ผ๊นŒ์ง€ ์ž˜ ์‚ฌ์šฉํ•˜๋˜ ๋ช…๋ น์–ด์ธ๋ฐ...

์˜ค๋ฅ˜ ๋ถ„์„

D:\Docker\liyo>docker-compose up -d --build
time="2024-08-19T10:51:56+09:00" 
level=warning msg="D:\Docker\ConnectedICS\apigateway\gatewayserver\docker-compose.yml:version is obsolete"
request returned Internal Server Error for API route and version 
http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.46/containers/json?all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.config-hash%22%3Atrue%2C%22com.docker.compose.project%3Dgatewayserver%22%3Atrue%7D%7D, 
check if the server supports the requested API version

์ด ์˜ค๋ฅ˜ ๋ฉ”์‹œ์ง€๋Š” Docker Compose ํŒŒ์ผ์˜ version ํ•„๋“œ๊ฐ€ ๋” ์ด์ƒ ์‚ฌ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค๊ณ  ์•ˆ๋‚ดํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

Docker ๋ฐ๋ชฌ๊ณผ Docker Compose ๋ฒ„์ „ ๊ฐ„์˜ ํ˜ธํ™˜์„ฑ ๋ฌธ์ œ๋กœ ๋ฐœ์ƒํ•œ ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค.

 

Docker Compose V2 ( = Cli plugin)์—์„œ๋Š” ํ•ญ์ƒ ์ตœ์‹  ๋ฒ„์ „์˜ compose ํŒŒ์ผ ์Šคํ‚ค๋งˆ๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— version ํ•„๋“œ๊ฐ€ ๋” ์ด์ƒ ํ•„์š”ํ•˜์ง€ ์•Š๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

 

์˜ค๋ฅ˜ ํ•ด๊ฒฐ

version: '3.8'
services:
  backservice-beusr:
    build:
      context: .
      dockerfile: Dockerfile-dev
    image: 'liyo'
    hostname: liyo
    container_name: liyo
    ports:
      - "1004:1004"
    user: root
    volumes:
      - "./log:/opt/app/log"
    networks:
      backend:
        aliases:
          - "liyo"
          
networks:
  backend:
    driver: bridge
    external: true
    internal: true

์˜ค๋ฅ˜ ๋ฐœ์ƒ ์‹œ์  ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋˜ docker-compose.yml ํŒŒ์ผ์ž…๋‹ˆ๋‹ค.

 

services:
  backservice-beusr:
    build:
      context: .
      dockerfile: Dockerfile-dev
    image: 'liyo'
    hostname: liyo
    container_name: liyo
    ports:
      - "1004:1004"
    user: root
    volumes:
      - "./log:/opt/app/log"
    networks:
      backend:
        aliases:
          - "liyo"
          
networks:
  backend:
    driver: bridge
    external: true
    internal: true

์ฒซ ๋ฒˆ์งธ ๋ผ์ธ์˜ version์„ ์ง€์›Œ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

D:\Docker\liyo>docker-compose up -d --build
request returned Internal Server Error for API route and version 
http://%2F%2F.%2Fpipe%2FdockerDesktopLinuxEngine/v1.46/containers/json?
all=1&filters=%7B%22label%22%3A%7B%22com.docker.compose.config-hash%22%3Atrue%2C%22com.docker.compose.project%3Dbearvd%22%3Atrue%7D%7D, check if the server supports the requested API version

D:\Docker\liyo>

 

version ์„ ์—†์•ค ํ›„ ๋นŒ๋“œ๋ฅผ ๋Œ๋ ค๋ณด๋‹ˆ, request returned Internal Server Error for API route and version ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์˜€์Šต๋‹ˆ๋‹ค.

 

Docker Compose๋Š” Docker ๋ฐ๋ชฌ์˜ API ๋ฒ„์ „ 1.46์„ ์š”์ฒญํ–ˆ์ง€๋งŒ, ๋ฐ๋ชฌ์ด ์ด ๋ฒ„์ „์„ ์ง€์›ํ•˜์ง€ ์•Š๋Š” ๊ฒƒ์œผ๋กœ ๋ณด์ž…๋‹ˆ๋‹ค.

์ด๋กœ ์ธํ•ด Docker Compose๊ฐ€ ์ปจํ…Œ์ด๋„ˆ ๋ชฉ๋ก์„ ๊ฐ€์ ธ์˜ค๋Š” API ์š”์ฒญ์— ์‹คํŒจํ–ˆ๊ณ , ๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜(Internal Server Error)๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค.

 

์œˆ๋„์šฐ ์šด์˜์ฒด์ œ๊ฐ€ ์—…๋ฐ์ดํŠธ๋˜๋ฉด์„œ WSL ๋„ ์ž๋™์œผ๋กœ ์—…๋ฐ์ดํŠธ๋˜์–ด์•ผ ํ•˜์ง€๋งŒ, ํ•จ๊ป˜ ์—…๋ฐ์ดํŠธ๋˜์ง€ ์•Š์•„ ํ˜ธํ™˜์„ฑ์— ๋ฌธ์ œ๊ฐ€ ์ƒ๊ธด ๊ฒƒ ๊ฐ™์Šต๋‹ˆ๋‹ค.

 

WSL ์€ Windows ์šด์˜์ฒด์ œ ๋‚ด์—์„œ Linux ๋ฐฐํฌํŒ์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ด์ฃผ๋Š” ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค.

Docker-compose.yml: `version` is obsolete

wsl --update

ํ•ด๋‹น ๋ช…๋ น์–ด๋กœ Windows Subsystem for Linux (WSL) ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ์—…๋ฐ์ดํŠธํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

 

์—…๋ฐ์ดํŠธ๋ฅผ ํ†ตํ•œ ์ž‘์—…์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. WSL ๊ตฌ์„ฑ ์š”์†Œ์˜ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.
  2. ์„ค์น˜๋œ Linux ๋ฐฐํฌํŒ์˜ ์ปค๋„ ๋ฒ„์ „์„ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.
  3. WSL ๊ด€๋ จ Windows ๊ตฌ์„ฑ ์š”์†Œ๋ฅผ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๋ฐ์ดํŠธํ•ฉ๋‹ˆ๋‹ค.

Docker-compose.yml: `version` is obsolete

์—…๋ฐ์ดํŠธ๋ฅผ ์™„๋ฃŒํ•˜๋‹ˆ ๋„์ปค์—์„œ API ๊ฒฝ๋กœ ๋ฐ ๋ฒ„์ „์— ๋Œ€ํ•œ ์š”์ฒญ์ด ๋‚ด๋ถ€ ์„œ๋ฒ„ ์˜ค๋ฅ˜๋ฅผ ๋ฐ˜ํ™˜ํ–ˆ์Šต๋‹ˆ๋‹ค


Docker Desktop์ด ์‚ฌ์šฉํ•˜๋Š” WSL ๋ฐฐํฌํŒ์ด ์˜ˆ๊ธฐ์น˜ ์•Š๊ฒŒ ์ข…๋ฃŒ๋˜์—ˆ์Šต๋‹ˆ๋‹ค.

์ด๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์™ธ๋ถ€ ์—”ํ‹ฐํ‹ฐ๊ฐ€ WSL์„ ์ข…๋ฃŒ(์˜ˆ: wsl --shutdown) ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

Docker Desktop์„ ๋‹ค์‹œ ์‹œ์ž‘ํ•ฉ๋‹ˆ๋‹ค. 

 

Restart๋ฅผ ํ†ตํ•ด ์žฌ์‹œ์ž‘ํ•ด ์ฃผ์—ˆ์Šต๋‹ˆ๋‹ค.

 

Docker-compose.yml: `version` is obsolete

 

์žฌ ์‹œ์ž‘ ํ›„ ๋นŒ๋“œ๊ฐ€ ์ž˜ ๋Œ์•„๊ฐ€๋Š” ๋ชจ์Šต์ž…๋‹ˆ๋‹ค.

๋ฐ˜์‘ํ˜•