개발

구글 클라우드 스터디잼 # 1 - Introduction to Docker

내공얌냠 2019. 8. 2. 09:14

Managing Deployments Using Kubernetes Engine 

의 선행으로 Introduction to Docker, Hello Node Kubernetes

 

 

docker build -t node-app:0.1 .

Dockerfile 이라고 저장해야 되는데 DockerFile 이라고 저장했어서 Dockerfile을 찾을 수 없다는 메시지가 나왔던 것.

같은 실수

https://blusky10.tistory.com/327

 

unable to evaluate symlinks in Dockerfile path

Docker 도큐먼트를 따라하다 보니 갑자기 에러가 난다. 분명 난 똑같이 붙여넣기 하고 그대로 한것 같은데.. https://docs.docker.com/get-started/part2/#build-the-app unable to prepare context: unable to ev..

blusky10.tistory.com

 

오류 발생2:

server.listen(port, hostname, () => {
                    ^
ReferenceError: hostname is not defined
    at Object. (/app/app.js:10:21)
    at Module._compile (module.js:577:32)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.runMain (module.js:611:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:160:9)
    at bootstrap_node.js:507:3

불러오는 중입니다...

알고 보니 app.js 에서 

const hostname = '0.0.0.0'; 을 안 써준 것.,

그리고 오류가 나도 실행이 되었기 때문에

docker: Error response from daemon: Conflict. The container name "/my-app" is already in use by container "d8ecfe97e3e9c988f8dda60c34ce8a36302b33261a2bd999a4aefdaf7ba66313". You have to remove (or rename) that container to be able to reuse tha
t name.

이런 오류가 뜨게 된다.

docker rm my-app 

이라는 명령어로 지워주고, 

docker build -t node-app:0.1 .

이렇게 빌드부터 다시 해주면 된다!

잘못된 js 로 빌드되었던 거니까!

 

다 해보니 1시간 30분정도 소요됨!

728x90
반응형