docker-compose 로컬환경 오류

이승준·2024년 4월 16일
0

yaml 구문오류

panic: interface conversion: interface {} is map[string]interface {}, not string

  mysql:
    ...
    environment:
      - MYSQL_ROOT_PASSWORD: test
      - MYSQL_DATABASE: myapp

원인: yaml 파일에서 구문오류가 있을 경우 발생한다
해결: 환경변수에는 -를 삭제해줘야 한다. - 삭제

port 문제

Error response from daemon: Ports are not available:
exposing port TCP 0.0.0.0:3306 -> 0.0.0.0:0: 
listen tcp 0.0.0.0:3306: bind: Only one usage of each socket address 
(protocol/network address/port) is normally permitted.
Services:
  ...
  mysql:
    ...
    ports:
      - "3306:3306"

원인:
docker가 사용중인 port를 다시 할당하려 할 때, 발생되는 오류
로컬pc에 mysql이 이미 3306포트를 사용하고 있어 발생된 오류

해결: mysql 중지

axios 500 error

Request failed with status code 500
AxiosError: Request failed with status code 500
    at settle (http://localhost:3000/static/js/bundle.js:42698:12)
    at XMLHttpRequest.onloadend (http://localhost:3000/static/js/bundle.js:
    41358:66)
    at Axios.request (http://localhost:3000/static/js/bundle.js:41859:41)

원인: backend 통신 오류
해결:

db.pool.query("SELECT * FROM lists", (err, results, fileds) => {
    if (err) return res.status(499).send(err);
    else return res.json(results);
  });

listslist 로 오타

덕분에 nginx내에서 cors옵션, docker mysql 컨테이너 터미널. 에러로그, 작성한 코드에 대해서 자세히 볼 수 있는 계기가 되었다.

0개의 댓글