Docker คืออะไร?
12 แบบนี้คือบอกว่าให้ใช้ image เวอร์ชัน 3.
0 71ffb25fc1e4 49 seconds ago 165 MB 18. 04 56def654ec22 3 days ago 63. 2 MB เราจะพบว่า Image tmppostfix:1. 0 ของเราสร้างเสร็จเรียบร้อยพร้อมใช้งานแล้วครับ การสร้าง Docker image ไว้ใช้งานเอง จบแล้วครับ ผู้เขียนหวังว่าบทความนี้จะช่วยให้ทุกท่านที่อยากจะสร้าง Image เอาไว้ใช้งานส่วนตัวได้มีความเข้าใจเกี่ยวกับ Docker image ได้ไม่มากก็น้อยนะครับ แล้วพบกันใหม่ในบทความหน้า สวัสดีครับ
|__ Dockerfile แก้ไข Dockerfile โดยเพิ่มคำสั่งตามตัวอย่างด้านล่าง FROM debian:stable WORKDIR /var/www RUN apt-get update RUN apt-get -y --no-install-recommends install curl RUN apt-get -y --no-install-recommends install ca-certificates RUN curl -o RUN apt-get purge -y curl RUN apt-get purge -y ca-certificates RUN apt-get autoremove -y RUN apt-get clean RUN rm -rf /var/lib/apt/lists/* สร้าง Docker image docker build -t debiandock. ดูจำนวน Layer ของ Image docker history debiandock ดูขนาดของ Images docker images จะเห็นว่า debiandock image มีขนาด 150MB แก้ไขไฟล์ Docker ตามตัวอย่างด้านล่าง FROM debian:stable RUN apt-get update && \ apt-get -y --no-install-recommends install curl \ ca-certificates && \ curl -o && \ apt-get purge -y curl \ apt-get autoremove -y && \ apt-get clean && \ rm -rf /var/lib/apt/lists/* สร้าง Docker image ใหม่ docker build -t small_debiandock.
เพิ่มการ ตั้งค่า locale ภาษาอังกฤษลงในคอนเทนเนอร์ RUN localedef -i en_US -f UTF-8 12. การดำเนินการที่จำเป็นอีกประการหนึ่งคือการตั้งค่า Docker image ของเราให้ฟัง ports ที่จำเป็นขณะใช้งานโดยใช้คำสั่ง EXPOSE EXPOSE 22 80 443 8080 8743 9990 9993 8009 4848 4949 13.