Gunju-Ko / TIL

Today I Learn
0 stars 0 forks source link

dockerfile 명령어 정리 #23

Open Gunju-Ko opened 3 years ago

Gunju-Ko commented 3 years ago

Dockerfile


# 이미지 빌드하기
$ docker build -t [tag name] [Directory of Dockerfile]

$ docker build -t app .
Gunju-Ko commented 3 years ago

참고

Gunju-Ko commented 3 years ago

VOLUME

VOLUME /tmp
VOLUME ["/data"]

*run에서 호스트 OS이 경로를 변경할 수 있다.

docker run -it -v /root/docker/log/:/var/log/ centos /bin/bash
Gunju-Ko commented 3 years ago

FROM

FROM ubuntu:16.04

MAINTAINER

MAINTAINER gunju.ko

COPY

COPY <src>... <dest>
COPY . /usr/src/app

ADD

RUN

RUN ["executable", "param1", "param2"]
RUN bundle install

CMD

CMD ["executable", "param1", "param2"]
CMD bundle exec ruby app.rb
ENTRYPOINT ["node"]
CMD ["index.js"]
# node index.js 실행
$ docker run test

# node main.js 실행
$ docker run test main.js

ENTRYPOINT

ENTRYPOINT ["python", "manage.py", "runserver"]

WORKDIR

EXPOSE

EXPOSE 4567

ENV

ENV <key> <value>
ENV DB_URL mysql

ARG

ARG port=8080
$ docker build --build-arg port=8080 .
CMD start.sh -h 127.0.0.1 -p ${port}

출처