A Docker image is a read-only template that contains everything needed to run an application (code, runtime, libraries, environment variables, configuration files). A Dockerfile is a text file used to build a Docker image, containing a series of build instructions. Common instructions include: FROM (specify base image), RUN (execute commands), COPY/ADD (copy files), CMD/ENTRYPOINT (container startup command), ENV (set environment variables), EXPOSE (declare ports), VOLUME (create mount points), WORKDIR (set working directory). Build an image using the docker build -t image-name:tag . command.
What is a Docker image and Dockerfile?
2月17日 23:39