build.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. :title: Build Command
  2. :description: Build a new image from the Dockerfile passed via stdin
  3. :keywords: build, docker, container, documentation
  4. ================================================
  5. ``build`` -- Build a container from a Dockerfile
  6. ================================================
  7. ::
  8. Usage: docker build [OPTIONS] PATH | -
  9. Build a new container image from the source code at PATH
  10. -t="": Tag to be applied to the resulting image in case of success.
  11. Examples
  12. --------
  13. .. code-block:: bash
  14. docker build .
  15. | This will read the Dockerfile from the current directory. It will also send any other files and directories found in the current directory to the docker daemon.
  16. | The contents of this directory would be used by ADD commands found within the Dockerfile.
  17. | This will send a lot of data to the docker daemon if the current directory contains a lot of data.
  18. |
  19. .. code-block:: bash
  20. docker build -
  21. | This will read a Dockerfile from Stdin without context. Due to the lack of a context, no contents of any local directory will be sent to the docker daemon.
  22. | ADD doesn't work when running in this mode due to the absence of the context, thus having no source files to copy to the container.