building image using docker code example Example 1: docker build docker build -t [tag] . Example 2: how to build docker image docker build -t image-name