meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
linux:docker:dockerfile [2017/02/10 12:32] – created niziaklinux:docker:dockerfile [2021/05/16 18:02] (current) niziak
Line 1: Line 1:
 +====== Dockerfile ======
 +
 +====== Build process ======
 +
 +Docker process ''Dockerfile'' stepping through the instructions.
 +[[https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/#/build-cache]]
 +
 +==== FROM ====
 +
 +==== ENTRYPOINT ====
 +
 +==== RUN ====
 +
 ==== ADD ==== ==== ADD ====
 [[https://docs.docker.com/engine/reference/builder/#/add]] [[https://docs.docker.com/engine/reference/builder/#/add]]
- +  * Copy new files, directories or URLs and adds them to filesystem of image 
-Copy new files, directories or URLs and adds them to filesystem of image +  All new files and directories are created with a UID and GID of 0. 
-All new files and directories are created with a UID and GID of 0. +  It supports TAR archive (gzip, bzip2 compressed)
-It supports TAR archive (gzip, bzip2 compressed)+
  
 ==== COPY ==== ==== COPY ====
 [[https://docs.docker.com/engine/reference/builder/#/copy]] [[https://docs.docker.com/engine/reference/builder/#/copy]]
  
-Copy new files or directories to the filesystem of container (not adding to image) +  * Copy new files or directories to the filesystem of container (not adding to image) 
-All new files and directories are created with a UID and GID of 0. +  All new files and directories are created with a UID and GID of 0.
- +
-  +
  
 >  Because image size matters, using ADD to fetch packages from remote URLs is strongly discouraged; you should use curl or wget instead.  >  Because image size matters, using ADD to fetch packages from remote URLs is strongly discouraged; you should use curl or wget instead. 
 >  That way you can delete the files you no longer need after they've been extracted and you won't have to add another layer in your image. >  That way you can delete the files you no longer need after they've been extracted and you won't have to add another layer in your image.
->    RUN mkdir -p /usr/src/things \ +>>    RUN mkdir -p /usr/src/things \ 
->      && curl -SL http://example.com/big.tar.gz \ +>>      && curl -SL http://example.com/big.tar.gz \ 
->        | tar -xJC /usr/src/things \ +>>        | tar -xJC /usr/src/things \ 
->      && make -C /usr/src/things all+>>      && make -C /usr/src/things all
 >  For other items (files, directories) that do not require ADD’s tar auto-extraction capability, you should always use COPY." >  For other items (files, directories) that do not require ADD’s tar auto-extraction capability, you should always use COPY."
  
 From source code comment: From source code comment:
-  Same as 'ADD' but without the tar and remote url handling.+>Same as 'ADD' but without the tar and remote url handling.
      
  
Line 31: Line 41:
 > >
 >Although ADD and COPY are functionally similar, generally speaking, COPY is preferred. That’s because it’s more transparent than ADD. COPY only supports the basic copying of local files into the >container, while ADD has some features (like local-only tar extraction and remote URL support) that are not immediately obvious. Consequently, the best use for ADD is local tar file auto-extraction >into the image, as in ADD rootfs.tar.xz /. >Although ADD and COPY are functionally similar, generally speaking, COPY is preferred. That’s because it’s more transparent than ADD. COPY only supports the basic copying of local files into the >container, while ADD has some features (like local-only tar extraction and remote URL support) that are not immediately obvious. Consequently, the best use for ADD is local tar file auto-extraction >into the image, as in ADD rootfs.tar.xz /.
 +
 +
 +==== EXPOSE ====
 +==== VOLUME ====