How do you build a Dockerfile?
Experience Level: Junior
Tags: DockerDocker CLIKubernetes
Answer
docker build <docker-context>
Example:
docker build .
docker build c:\app
You can also use -f parameter to pass a path to the docker file:
Example:
docker build -f Dockerfile ../../
When you want to provide build arguments, pass them like this:
Example:
docker build --file Dockerfile --build-arg PAT=xyz ../../
Related Docker job interview questions
What is Docker Detached Mode good for and how do you use it?
Docker JuniorHow do you remove all stopped Docker containers, unused networks, dangling images and build caches?
DockerDocker CLI JuniorHow do you delete a Docker image from the local file system?
DockerDocker CLI JuniorHow do you delete a stopped Docker contaienr?
DockerDocker CLI JuniorHow do you save a Docker container to Docker Hub?
DockerDocker CLI Junior