Ravindra BagaleCourses & study guides मराठी

Chapter 6: Why Docker, Images and How a Container Is Created

6.12 Lab — one image, three names

Lab

Copy the Dockerfile, index.php, badge-nginx.conf and the docker run fences in this chapter. There is no separate download.

  1. docker version. Write down whether both client and server answered.
  2. In one sentence: who builds the tag, and who (operations, the server-side employee) runs that tag on the EC2.
  3. docker run official nginx and curl host port 8080. Save the status line.
  4. Build badge-php:1.0 from FROM php:8-apache and COPY. Curl it on 8081.
  5. In your notes, one sentence on why you will not use docker commit for the image you hand to operations.
  6. Start MySQL with the named volume and the lab placeholder. docker volume ls and confirm the volume name.
  7. docker history php:8-apache. Name one 0B layer and one layer with a size.
  8. If you have a Docker Hub account, tag YOURUSER/badge-php:1.0 and push it. If you do not, write the tag you would push. Do not put a password in a file.

Practice task

List the four ways a container appears in this chapter and star the one that belongs in Git.

Thodkyaat sangaycha tar

  • Installing PHP and libraries straight on an EC2 causes library clashes, "works on my laptop", a hard rollback and a developer vs operations blame meeting.
  • One image tag is the object both sides run. A container shares the host kernel. It is not a full VM.
  • Image is the template. Container is the running instance. docker rm does not delete the image.
  • Four ways: docker run, docker build then run, docker compose up (Chapter 7), and docker commit only in an emergency.
  • nginx is the front door, php:8-apache runs the badge, mysql stores rows on a named volume. The password is a lab placeholder. USER www-data on php:8-apache does not bind port 80.
  • docker history shows layers. Docker Hub is login, tag, push, pull. No password in the file.

Samajla ka? Nasel tar 6.1 chi EC2 story aani 6.8 che teen containers punha vacha. Aata pudhe jaauya rozche commands, networks, volumes aani Compose kade.

Ravi Sir's Cards for this lesson

मराठी cards