Docker Images
How to create my own image?
Order
- OS - Ubuntu
- Update apt repo
- Install dependencies using apt
- Install Python dependencies using pip
- Copy source code to /opt folder
- Run the web server using “flask” command
Dockerfile
| |
INSTRUCTION ARGUMENT
Build
docker build . -f Dockerfile -t <image name>
Push
docker push <image name>
Layered architecture

- each layer only store the changes from the previous layer
docker history <image name>
Environment Variables
-edocker run -e <KEY>=<value> <image name>
Inspect Environment Variable
docker inspect <container name | id>
Command vs Entrypoint
설명
Command
CMD- instruction the command line parameters passed will get replaced entirely.
Entrypoint
ENTRYPOINT- command line parameters will get appended.
- if parameter is not given, it will get error that the operand is missing
- How to give and default value for entrypoint?
1 2ENTRYPOINT ["command"] CMD ["param1"]
- How to give and default value for entrypoint?
- how to override entrypoint?
docker run --entrypoint <executable> <image-name> <param>
ëª…ë ¹ì–´
CMDCMD command param1CMD ["command", "param1"]
ENTRYPOINTENTRYPOINT ["command"]