Docker Flashcards
10 dockerfile instructions
FROM ubi8/ubi:8.5 2
LABEL
MAINTAINER
RUN
EXPOSE
Workdir
ENV
ADD
COPY
VOLUME
USER
ENTRYPOINT
CMD
First line of a dockerfile
Comment that begins with hashtag
Declare the image that will be extended
FROM ubi8/ubi:8.5 2
Add metadata
LABEL KEY=VALUE
LABEL description=”This is a custom httpd”
Populate author field
MAINTAINER John Doe
builds a new image based on dockerfile
podman build -t NAME:TAG DIR
executes commands
RUN
indicates that the container listens on the specified network port
EXPOSE 80
define environment variables that are available in the container
ENV LogLevel “info”
copies files or folders from a local or remote source and adds them to the container’s file system
ADD http://someserver.com/filename.pdf /var/www/html
copies files from the working directory and adds them to the container’s file system
COPY ./src/ /var/www/html/
specifies the username or the UID to use when running the container image
USER apache
specifies the default command to execute when the image runs in a container.
ENTRYPOINT [“/usr/sbin/httpd”]
provides the default arguments for the ENTRYPOINT instruction
CMD [“-D”, “FOREGROUND”]
Diff between ADD and COPY
ADD instruction unpacks the archive as a directory to the destination folder. The COPY instruction does not have this functionality