Title: Docker

Q: Docker container
A: - sandboxed process
- portable
- minimal
- created by "docker run"
- living instance of a docker image

Q: Docker image
A: - read-only files containing all source code and dependencies for an application to run
- represent a "snapshot" of an application/environment at a specific point in time
- layered structure with caches created at each intermediate instruction

Q: Docker registry
A: Cataloging system for Docker images, e.g. Docker Hub.

Q: Docker daemon
A: - Listens for Docker API requests
- Manages Docker objects
- Middle-man between the user interface and the internals

Q: Inheriting an existing image
A: We use the "FROM" keyword, e.g.
1 | FROM python:3.8-alpine

Q: Executable form vs. Shell form
A: Executable form (preferred) is parsed as a JSON array, requiring double-quotes and square brackets, bypassing shell processing. For example, variable susbtitution will not happen without invoking "sh -c".
1 | RUN [“apt-get”, “install”, “vim”]
Shell form: you can use backslashes for multiple lines and ordinary shell tools.
1 | RUN apt-get -y update
Third form is for setting default parameters in CMD:
1 | CMD [“parameter1”, “parameter2”]

Q: RUN vs. CMD vs. ENTRYPOINT
A: RUN:
- Typically used to install applications
- Creates a new image layer
- Can be many such commands
1 | RUN [“apt-get”, “install”, “vim”]
CMD:
- Only one per file (last one overrides)
- Sets defaults if no CLI arguments are given
1 | CMD ["app.py"]
ENTRYPOINT:
- Same as CMD except it cannot be overriden by CLI
1 | ENTRYPOINT [ "python" ]

Q: COPY
A: The COPY instruction lets us copy a file (or files) from the host system into the image
1 | COPY . /app