yes a dockerimage can be build from a tarball containing the Dockerfile
.
Let's assume we have a dockerfile called myDockerfile
which contains the following scripts
FROM ubuntu
COPY ./venv /
CMD ["/bin/bash"]
myDockerFile
is present inside the folder dockerfiles
FOLDER --> dockerfiles
FILE -----------> myDockerFile
the tarball for folder dockerfiles
is called dockerfiles.tar
the docker command to build the image will be:-
cat dockerfiles.tar | docker build - -f dockerfiles/myDockerFile -t mydockerimage
note:-
-f denotes the docker file in context to the tarball , if the dockerfile is called 'Dockerfile'
then there is no need to mention the name of the filename verbose