Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 게임
- 스마트 컨트랙트
- Linux
- 쿠버네티스
- 보안
- review
- 비트코인
- 부동산
- 거래
- kubernetes
- 젤다 왕눈
- 투자
- 암호화폐
- Docker
- strongloop
- Three
- 리뷰
- Games
- 주식
- game
- loopback
- PC
- 이더리움
- threejs
- 스마트 계약
- ps4
- 블록체인
- 탈중앙화
- angular
- 시장
Archives
- Today
- Total
BaeBox
Docker - Dockerfile 본문
반응형
# use this empty Dockerfile to build your assignment # This dir contains a Node.js app, you need to get it running in a container # No modifications to the app should be necessary, only edit this Dockerfile # Overview of this assignment # use the instructions from developer below to create a working Dockerfile # feel free to add command inline below or use a new file, up to you (but must be named Dockerfile) # once Dockerfile builds correctly, start container locally to make sure it works on http://localhost # then ensure image is named properly for your Docker Hub account with a new repo name # push to Docker Hub, then go to https://hub.docker.com and verify # then remove local image from cache # then start a new container from your Hub image, and watch how it auto downloads and runs # test again that it works at http://localhost # Instructions from the app developer # - you should use the 'node' official image, with the alpine 6.x branch FROM node:6-alpine # - this app listens on port 3000, but the container should launch on port 80 # so it will respond to http://localhost:80 on your computer EXPOSE 3000 # - then it should use alpine package manager to install tini: 'apk add --update tini' RUN apk add --update tini # - then it should create directory /usr/src/app for app files with 'mkdir -p /usr/src/app' RUN mkdir -p /usr/src/app # - Node uses a "package manager", so it needs to copy in package.json file WORKDIR /usr/src/app COPY package.json package.json # - then it needs to run 'npm install' to install dependencies from that file RUN npm install && npm cache clean # - to keep it clean and small, run 'npm cache clean --force' after above # - then it needs to copy in all files from current directory COPY . . # - then it needs to start container with command '/sbin/tini -- node ./bin/www' CMD ["tini", "--", "node", "./bin/www"] # - in the end you should be using FROM, RUN, WORKDIR, COPY, EXPOSE, and CMD commands # Bonus Extra Credit # this will not have you setting up a complete image useful for local development, test, and prod # it's just meant to get you started with basic Dockerfile concepts and not focus too much on # proper Node.js use in a container. **If you happen to be a Node.js Developer**, then # after you get through more of this course, you should come back and use my # Node Docker Good Defaults sample project on GitHub to change this Dockerfile for # better local development with more advanced topics # https://github.com/BretFisher/node-docker-good-defaults |
사용자는 Dockerfile 을 이용하여 이미지를 빌드할 수 있다. Dockerfile은 이미지를 만들기 위해 사용자가 호출할 수 잇는 모든 기능을 제공한다. Docker build 를 사용하여 사용자는 이미지를 빌드할 수 있다.
명령어:
빌드(도커파일 -> 이미지) :
docker build [OPTIONS] PATH | URL | -
ex) docker build -t testnode .
반응형
'개발 관련' 카테고리의 다른 글
Docker - Docker Swarm (0) | 2019.10.23 |
---|---|
Docker - Persistent Data, Data Volumes & Bind Mounting (0) | 2019.10.23 |
Docker Compose (docker-compose) (0) | 2019.10.23 |
Docker - Container (0) | 2019.10.23 |
Docker Image (0) | 2019.10.23 |
Comments