User Tools

Site Tools


dockerfiles

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
dockerfiles [2019/10/08 15:03]
rpjday [CMD]
dockerfiles [2020/01/03 11:58] (current)
rpjday [Q]
Line 3: Line 3:
 Summary of Dockerfiles. Summary of Dockerfiles.
  
-External links (coming soon) ...+External links
 + 
 +  * [[https://​takacsmark.com/​dockerfile-tutorial-by-example-dockerfile-best-practices-2018/​|https://​takacsmark.com/​dockerfile-tutorial-by-example-dockerfile-best-practices-2018/​]] 
 +  * [[https://​docs.docker.com/​engine/​reference/​builder/​|https://​docs.docker.com/​engine/​reference/​builder/​]] 
 +  * [[https://​www.docker.com/​blog/​intro-guide-to-dockerfile-best-practices/​|https://​www.docker.com/​blog/​intro-guide-to-dockerfile-best-practices/​]] 
 + 
 +===== Notes ===== 
 + 
 +  * ''​podman''​ also reads a ''​Containerfile'' ​(also CPP-processed ''​Containerfile.in''​) 
 +  * default context is current directory (".") 
 +  * ''​rm ~/.config/​containers/​libpod.conf''​ 
 +  * ''​.dockerignore''​ file (podman variant?)
  
 ===== Q ===== ===== Q =====
  
 +  * Applicability of Containerfile?​ Also "​.in"​ suffix for podman?
 +  * COPY versus ADD?
   * Does every new FROM directive start a new "build stage"?​   * Does every new FROM directive start a new "build stage"?​
   * What is the scope of an ENV versus ARG directive?   * What is the scope of an ENV versus ARG directive?
   * Can a context be a local tarball? Others?   * Can a context be a local tarball? Others?
-  * How to use ''​--cache-from''?​+  * How to use ''​%%--%%cache-from''​
 +  * relevance of ''​.dockerignore''​ with ''​podman''/''​buildah''?​ 
 +  * Can we display context?
  
 ===== Usage ===== ===== Usage =====
 +
 +Needs:
 +
 +  * Dockerfile/​Containerfile
 +  * context
  
 <​code>​ <​code>​
Line 34: Line 54:
   * syntax (BuildKit only)   * syntax (BuildKit only)
  
-==== .dockerignore ====+==== .dockerignore ​(in root dir of context) ​====
  
-You can safely exclude ''​Dockerfile''​ and ''​.dockerignore'';​ they'​re sent, anyway.+  * You can safely exclude ''​Dockerfile''​ and ''​.dockerignore'';​ they'​re sent, anyway. 
 +  * Uses Go's filepath.Match rules 
 +  * Also ''​**/​*.go'',​ and exceptions using ''​!''​ 
 +  * last match takes precedence
  
 ===== Dockerfile directives ===== ===== Dockerfile directives =====
Line 47: Line 70:
 ==== FROM ==== ==== FROM ====
  
-  * Dockerfile must start with a ''​FROM''​ instruction+  * Dockerfile must start with a ''​FROM''​ instruction ​(after possible ''​ARG''​ directives)
   * sets a //base image//, initializes a new //build stage//   * sets a //base image//, initializes a new //build stage//
   * can occur multiple times in a Dockerfile, perhaps to make one build stage dependent on another   * can occur multiple times in a Dockerfile, perhaps to make one build stage dependent on another
Line 87: Line 110:
 </​code>​ </​code>​
  
-==== COPY ====+==== COPY (preferred unless you need ADD extensions) ​====
  
   * ''​.dockerignore''​ file, see [[https://​docs.docker.com/​engine/​reference/​builder/#​dockerignore-file|here]]   * ''​.dockerignore''​ file, see [[https://​docs.docker.com/​engine/​reference/​builder/#​dockerignore-file|here]]
Line 122: Line 145:
   * TCP if protocol is not specified   * TCP if protocol is not specified
   * use ''​docker run -p/​-P''​ to actually expose ports   * use ''​docker run -p/​-P''​ to actually expose ports
 +
 +==== HEALTHCHECK ====
dockerfiles.1570546990.txt.gz · Last modified: 2019/10/08 15:03 by rpjday