Docker Flashcards
Keyword to inherit an image
FROM {image} [as {name}]
Keyword to provide defaults to an executing container
CMD
“exec” form of CMD
CMD [“executable”, “param1”, “param2”]
Form of CMD used to provide default parameters to ENTRYPOINT
CMD [“param1”, “param2”]
shell form of CMD
CMD executable param1 param2
Keyword for configuring a container which will run as an executable
ENTRYPOINT
“exec” form of ENTRYPOINT
ENTRYPOINT [“exe”, “param1”, “param2”]
(CLI)Run a new command in an existing container
docker exec -it {container} {cmd}
shell form of ENTRYPOINT
ENTRYPOINT exe param1 param2
(CLI) Override ENTRYPOINT given in Dockerfile
docker run –entrypoint {entry cmd}
(CLI) Connect to shell in new container
docker run -it {img}
(CLI) Run a new command in an existing container
docker exec -it {container} {cmd}
(CLI) Attach to stdio of running container
docker attach {container}
Keyword to execute command in new layer
RUN
“exec” form of RUN
RUN [“exe”, “param1”, “param2”]
shell form of RUN
RUN {cmd}
Keyword to adjust shell used by RUN
SHELL [“exe”, “param”]
Default shell used by RUN
[“/bin/sh”, “-c”]
Keyword to set the working directory
WORKDIR {path}
Default WORKDIR
/
Keyword to duplicate files from context into image
COPY