Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Docker Container Management-Dockerfile

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The docker image is generated using the dockerfile file. Dockerfile is a text file that forms the new basic syntax of the image through command line execution.

FROM builds the container based on that image

Example: centos:7 the first instruction of any Dockerfile must be a FROM instruction

MAINTAINER image maintainer information

Example: unixzhang this information will be written to the Author attribute of the mirror

The Shell command that RUN runs when building the image

Example: RUN ["yum", "install", "nginx"] or RUN yum install nginx

Shell commands executed when CMD runs the container

Example: CMD [". / sbin/php-fpm", "- c", "/ usr/local/php/etc/php-fpm.conf"] or CMD ["/ usr/bin/sshd", "- D"]

EXPOSE declares the port on which the container is running

Example: EXPOSE 8080

ENV sets the environment variables in the container

Example: ENV JAVA_HMOE / usr/local/jdd1.8.0_91

ADD copies a file or directory to the image. If it is a URL or a compressed package, it will be downloaded or decompressed automatically.

ADD html.tar.gz / var/www/html

COPY copies a file or directory to an image. When using a local directory as the source destination, COPY is recommended.

Example: COPY. / start.sh / start.sh

Shell commands executed when ENTRYPOINT runs the container

Example: ENTRYPOINT / bin/bash-c 'start.sh' ENTRYPOINT ["/ bin/sh", "- c", "/ start.sh"]

VOLUME specifies the container mount point to the host automatically generated directory or other container

Example: VOLUME ["/ var/lib/mysql"]

WORKDIR sets working directories for RUN,CMD,ENTRYPOINT,COPY and ADD

Example: WORKDIR / data

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report