August 3, 2020

[Docker] สรุปคำสั่งใน Docker file

สรุปคำสั่งใน docker file

FROM เลือก base image

RUN execute command

CMD execute command แต่มีได้แค่ครั้งบเดียวใน file ถ้ามีมากกว่าหนึ่งจะใช้อันสุดท้าย หรือใช้เป็น default parameter ให้ ENTRYPOINT

LABEL ใส่ metadata ให้ image

EXPOSE กำหนดให้ container รอรับ request ตาม port ที่กำหนด ใช้คู่กับ  -p ตอนใช้ docker run

ENV กำหนดตัวแปร environment ให้ตอนทำ image และ container

ADD copy file เข้า image

COPY copy file เข้า imageต่างกับ ADDตรงที่ไฟล์ต้นฉบับได้เฉพาะ local เป็น remote url ไม่ได้

ENTRYPOINT คำสั่งที่จะให้ run หลังจากstart container

VOLUME กำหนด mount point ให้ image

USER กำนหด user ที่จะใช้ run คำสั่ง RUN CMD ENTRYPOINT

WORKDIR กำหนด working directory  สำหรับ  RUN CMD ENTRYPOINT COPY ADD

ARG กำหนดตัวแปรไว้สำหรับตอน BUILD

ONBUILD ใช้สำหรับให้ run คำสั่งแต่ให้รอ trigger เพื่อทำงานต่อในกรณีที่ต้องรอให้ build ตัวอื่นก่อน

STOPSIGNAL สั่งให้หยุดโดยใช้ system call signal

SHELL เปลี่ยนไปใช้ shell ที่กำหนด

 

ref https://docs.docker.com/engine/reference/builder/

March 2024
S M T W T F S
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Who We Are

Wealth Management System Limited (WMSL) is a leading financial software company in Thailand. We provide reliable, trusted solutions to financial institutions in asset, treasury and risk management. With our innovative software systems and value added consulting services, we help our customers significantly improve their operational efficiency, reduce costs and minimize risks.

Contact Info

Chin Pong Building, 383 Ladya Road, Klongsan, Bangkok 10600 Thailand

Phone: +66(0) 2-861-4820 Ext. 5620-5622, 5628, 5629
Fax: +66 (0) 2-861-4400
Email: marketing@wealth.co.th

Weekdays: 8:00 am - 5:00 pm
Saturday & Sunday: Closed

Copyright © 2022 WMSL. All Rights Reserved