Skip to content
StackDecode
BeginnerLesson 7 of 26

Building and tagging images

Turn a Dockerfile into an image and give it a useful name.

bash
docker build -t myapp:1.0 .            # build from ./Dockerfile
docker build -t myapp:1.0 -f docker/Dockerfile.prod .
docker tag myapp:1.0 myuser/myapp:1.0  # add another name
docker push myuser/myapp:1.0           # needs: docker login
docker run --rm myapp:1.0

The trailing . is the build context: the folder whose files can be copied into the image. Everything in it is sent to the builder, which is why .dockerignore matters.