Debian 12 bookworm
Sponsored Link

Podman : Use Dockerfile2023/06/21

Use Dockerfile and create Container images automatically.
It is also useful for configuration management for Container images.
[1] For example, Create a Dockerfile that Nginx is installed and started.
vi Dockerfile
# create new

FROM debian
MAINTAINER ServerWorld <>

RUN apt-get update
RUN apt-get -y install nginx
RUN echo "Dockerfile Test on Nginx" > /var/www/html/index.html

CMD ["/usr/sbin/nginx", "-g", "daemon off;"]

# build image ⇒ podman build -t [image name]:[tag] .

podman build -t .

STEP 1/7: FROM debian
STEP 2/7: MAINTAINER ServerWorld <>
--> 00970b06f91
STEP 3/7: RUN apt-get update


--> e2938e55cf7
Successfully tagged

podman images

REPOSITORY                TAG         IMAGE ID      CREATED             SIZE    latest      e2938e55cf7c  About a minute ago  158 MB  latest      f047c6f28c56  8 minutes ago       260 MB  latest      49081a1edb0b  8 days ago          121 MB

# run container

podman run -d -p 80:80


podman ps

CONTAINER ID  IMAGE                          COMMAND               CREATED         STATUS             PORTS               NAMES
fd506a88790a  /usr/sbin/nginx -...  11 seconds ago  Up 11 seconds ago>80/tcp  festive_clarke

# verify accesses

curl localhost

Dockerfile Test on Nginx
# also possible to access via container network

podman inspect -l | grep \"IPAddress

            "IPAddress": "",
                    "IPAddress": "",


Dockerfile Test on Nginx
The format of Dockerfile is [INSTRUCTION arguments] .
Refer to the following description for INSTRUCTION.
FROM It sets the Base Image for subsequent instructions.
MAINTAINER It sets the Author field of the generated images.
RUN It will execute any commands when Docker image will be created.
CMD It will execute any commands when Docker container will be executed.
ENTRYPOINT It will execute any commands when Docker container will be executed.
LABEL It adds metadata to an image.
EXPOSE It informs Docker that the container will listen on the specified network ports at runtime.
ENV It sets the environment variable.
ADD It copies new files, directories or remote file URLs.
COPY It copies new files or directories.
The differences of [ADD] are that it's impossible to specify remote URL and also it will not extract archive files automatically.
VOLUME It creates a mount point with the specified name and marks it as holding externally mounted volumes from native host or other containers.
USER It sets the user name or UID.
WORKDIR It sets the working directory.

Matched Content