Building creates an image from a Dockerfile. Run docker build -t <name> . to build from the Dockerfile in the current directory. The . is the build context: the files Docker has access to for COPY instructions. Keep large files out of it using .dockerignore.
$ docker build -t myapp:latest . # build and tag $ docker build -t myapp:1.0 -f Dockerfile.prod . # custom Dockerfile $ docker build --no-cache -t myapp . # rebuild without using cache
Docker sends the entire build context to the daemon on every build, so large build contexts slow builds. Use .dockerignore to exclude files (like .git/, node_modules/, etc.). Builds fail if the Dockerfile has errors or if a RUN command exits with a non-zero status.