Docker & Kubernetes for Developers · บทเรียน

การจัดการอิมเมจและคอนเทนเนอร์ Docker

เรียนรู้คำสั่ง Docker ที่ใช้ในชีวิตประจำวันสำหรับแสดงรายการ ตรวจสอบ หยุด ลบ และทำความสะอาดอิมเมจและคอนเทนเนอร์ เพื่อให้สภาพแวดล้อมเป็นระเบียบ

บทเรียน 4 จาก 413 ขั้นตอน

การจัดการอิมเมจและคอนเทนเนอร์ Docker เป็นบทเรียน Docker & Kubernetes for Developers ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Docker & Kubernetes for Developers และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Docker & Kubernetes for Developers มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Images vs Containers

Two core concepts: an image is a read-only template (like a class), and a container is a running instance of it (like an object). One image, many containers.

Listing Images

List the images on your machine with docker images. Each row shows the repository, tag, id, and size.

docker images

Listing Containers

docker ps shows running containers; add -a to include stopped ones too.

docker ps -a

Inspecting a Container

docker inspect prints detailed JSON about a container or image — its config, network, mounts, and more.

docker inspect my_container

Viewing Logs

Read a container's output with docker logs. Add the -f flag to follow the stream live, like tail -f.

docker logs -f my_container

Stopping and Starting

docker stop halts a container gracefully (SIGTERM, then SIGKILL after a grace period) and docker start brings it back.

docker stop my_container
docker start my_container

Removing a Container

Delete a stopped container with docker rm. You can't remove a running one unless you force it with -f.

docker rm my_container

Removing an Image

Remove an image with docker rmi. It fails if any container still references it, so clear those dependent containers first.

docker rmi nginx:latest

Running a Command Inside

docker exec runs a command inside a running container. With -it you get an interactive shell to poke around.

docker exec -it my_container sh

Cleaning Up with prune

Stopped containers and dangling images pile up over time. docker system prune reclaims all that space in one command.

docker system prune

Naming Containers

Give a container a friendly handle with --name at run time, so you reference it by name instead of a random id.

docker run --name web -d nginx

Quick Check

Test your Docker management knowledge.

Recap

Recap: list with docker images and ps -a, dig in with inspect and logs, control lifecycle via stop/start/rm/rmi, and clean up with system prune.

เริ่มต้นได้ฟรี

เรียนรู้ Docker & Kubernetes for Developers ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
12
บทเรียน
48

คำถามที่พบบ่อย

บทเรียน “การจัดการอิมเมจและคอนเทนเนอร์ Docker” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การจัดการอิมเมจและคอนเทนเนอร์ Docker” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Docker & Kubernetes for Developers ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Docker & Kubernetes for Developers มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การจัดการอิมเมจและคอนเทนเนอร์ Docker”

เรียนรู้คำสั่ง Docker ที่ใช้ในชีวิตประจำวันสำหรับแสดงรายการ ตรวจสอบ หยุด ลบ และทำความสะอาดอิมเมจและคอนเทนเนอร์ เพื่อให้สภาพแวดล้อมเป็นระเบียบ คุณปฏิบัติ Docker & Kubernetes for Developers ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Docker & Kubernetes for Developers หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Docker & Kubernetes for Developers บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน

บทเรียน “การจัดการอิมเมจและคอนเทนเนอร์ Docker” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Docker & Kubernetes for Developers นี้ได้ไหม

ได้ บทเรียน Docker & Kubernetes for Developers ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. บทนำสู่การทำคอนเทนเนอร์
  2. การติดตั้ง Docker และคำสั่งพื้นฐาน
  3. การเรียกใช้คอนเทนเนอร์แรกของคุณ
  4. การจัดการอิมเมจและคอนเทนเนอร์ Docker
← กลับไปที่ Docker & Kubernetes for Developers