Automatically translated.View original post

Get to know Docker, and what is it?

What is 🐳 Docker? Finish summary in one post!

Have you ever encountered the problem "We can turn on the machine, but our friends can't turn it on"? This problem will disappear if you use DOCKER!

📦 1.Docker?

The simple comparison is "containers" where all the necessary programs, code, and environments are combined, allowing us to put this set anywhere in the world where everything still works 100%.

✅ 2.3 Advantages to allow Docker

* Run Anywhere: Don't waste time down the Driver or setting up a new machine. Just have a Docker and run immediately.

* Light and fast: Do not eat the specification like the VM (Virtual Machine). Open the program in seconds.

* The system does not strike: I want to run different versions of the program on one device because each cabinet is clearly separated.

🚀 3.Terminology should know (New Edition)

* Dockerfile: It's like a "menu order" on what to wear inside the cabinet.

* Image: Like "food that has already been boxed" (waiting to be eaten)

* Container: "When we open the eating box" is a running program.

🛠️ 4. Who needs it?

* Developer (Dev): Share work environment with team

* System Line (Ops): It allows for easy and unbreakable web adoption (Deploy)

💡 Conclusion: Docker is to make our application into a seamless "parcel" sent to run anywhere.

# Known IT # Includes IT matters # IT

# IT should know # Technology

1/9 Edited to

... Read moreถ้าเพิ่งเริ่มค้นหา “Docker คืออะไร” ฉันชอบอธิบายแบบง่ายที่สุดว่า Docker คือวิธี “แพ็กแอป” ของเราให้เป็นเหมือนตู้คอนเทนเนอร์ที่ข้างในมีครบทั้งโค้ด โปรแกรมที่ต้องใช้ และการตั้งค่าต่างๆ พอแพ็กเสร็จ เราก็ยกตู้ใบนี้ไปรันที่เครื่องไหนก็ได้ที่มี Docker โดยผลลัพธ์ควรจะเหมือนกันมากๆ นี่แหละที่ช่วยลดดราม่าแนว “ทำไมเครื่องฉันรันได้ แต่เครื่องเธอรันไม่ได้” เวลาเริ่มใช้จริง ฉันมักไล่ทำความเข้าใจ 3 คำนี้ก่อน เพราะคนสับสนบ่อย: - Image: แม่แบบของตู้คอนเทนเนอร์ เหมือนของที่แพ็กไว้เรียบร้อย ยังไม่เริ่มทำงาน - Container: ตอนที่เราหยิบ Image มารันจริง กลายเป็นโปรแกรมที่กำลังทำงานอยู่ - Dockerfile: ไฟล์คำสั่งสำหรับ “สร้าง Image” ว่าต้องติดตั้งอะไร คัดลอกไฟล์ไหน รันคำสั่งอะไรบ้าง แล้ว Docker ต่างจาก Virtual Machine (VM) ยังไง? จากประสบการณ์ของฉัน VM คือยกทั้งระบบปฏิบัติการขึ้นมาอีกชุด ทำให้กินทรัพยากรเยอะกว่าและเปิดช้ากว่า ส่วน Docker จะพยายามแชร์ส่วนของระบบกับเครื่องหลัก (host) แล้วแยกสภาพแวดล้อมของแต่ละแอปด้วยคอนเทนเนอร์ ทำให้เบากว่าและสตาร์ตไวกว่า เหมาะกับงานพัฒนาและทดสอบมากๆ ตัวอย่างสถานการณ์ที่ Docker ช่วยได้จริง: 1) ทำโปรเจกต์ทีมเดียวกัน แต่แต่ละคนใช้เวอร์ชันภาษา/ไลบรารีไม่เท่ากัน: เราสร้าง Image กลางให้ทีมใช้ เวอร์ชันตรงกันทั้งทีม 2) อยากรันหลายเวอร์ชันในเครื่องเดียว (เช่น Node คนละเวอร์ชัน): แยกรันเป็นคนละคอนเทนเนอร์ ระบบไม่ตีกัน 3) ตอน Deploy: เอา Image เดิมจากเครื่อง dev ไปใช้บน server/คลาวด์ได้ ลดความเสี่ยงจากการตั้งค่าไม่เหมือนกัน ทิปเล็กๆ สำหรับมือใหม่ที่ฉันใช้แล้วเวิร์ก: - เริ่มจากรันคอนเทนเนอร์สำเร็จรูปก่อน (เช่น nginx, mysql) เพื่อให้เห็นภาพว่า “รันได้ทุกที่” จริง - ฝึกอ่าน Dockerfile ทีละบรรทัด จะเข้าใจว่าแต่ละชั้น (layer) สร้าง Image ยังไง - ถ้าเริ่มทำหลายบริการพร้อมกัน (เว็บ + ฐานข้อมูล) ค่อยไปต่อด้วย docker compose จะสะดวกมาก สรุปสั้นๆ: Docker คือเครื่องมือคอนเทนเนอร์ที่ทำให้แอปของเราเหมือน “พัสดุ” พร้อมส่ง—Dev ใช้แชร์สภาพแวดล้อม, Ops ใช้ช่วย Deploy ให้เสถียรขึ้น และทั้งทีมทำงานร่วมกันได้ลื่นกว่าเดิม