Docker containers contd
Running Containers
- Attached vs detached mode: Attached mode is where your terminal will be showing stdout, stderr of the container, whereas in detached mode the container runs in the background without obstructing terminal.
- Default mode is attached.
Dockerfile instructions
CMD vs ENTRYPOINT
- CMD:
- executes the command that starts the application in container.
- CMD can be overriten by passing values after docker image name in container run
- ENTRYPOINT: Refer Here for official docs
- executes the command that starts the application in container
- When we run the container it executes
ENTRYPOINT + CMD- IF ENTRYPOINT exists CMD will be arguments to entrypoint
- Recommended practice: Most of the applications use CMD only
Docker image layers
- Refer Here for image layers
Exercise:
- I have to download a software from some website. What is the gurantee that the file has not been tampered.
- How to verify if the downloaded file is what the software provider published.
