A container is a virtualized server that can host a microservice. Containers isolate services from one another while dividing a computer’s resources among them. Compared with a virtual machine, which includes a complete operating system on fully virtualized hardware, a container is smaller and uses computing resources more efficiently. section 3.3
A Docker image is the bootable snapshot; a container is the running instance created from it. The image holds the microservice’s code, dependencies, and assets and is immutable. After it starts as a container, its filesystem can be modified. section 3.4
To test a packaged microservice before publishing it:
- Build its image from a Dockerfile, then use docker run to start a local container. section 3.8 section 3.12
- Check the resulting container ID, inspect it with docker container list, and use docker logs with that ID to read its output. section 3.8.3
- If it misbehaves, open a shell with docker exec -it <container-id> bash; use commands such as ls and ps to inspect its files and process. section 3.8.4
cd chapter-3/example-1 docker run -d -p 3000:3000 -e PORT=3000 video-streaming
This runnable command starts the video-streaming image in the background, forwards host port 3000 to container port 3000, and sets PORT=3000 inside the container. section 3.8.3
Once tested, the image can be published to a private container registry for later deployment to a Kubernetes cluster. Running one container locally verifies the microservice before that production step. section 3.6 section 3.8.3


























