not able to build a specific Dockerfile
I am able a build a Dockerfile like
docker build -t deepak/ruby .
But for a Dockerfile which is not named
# DOCKER-VERSION 0.4.8 FROM deepak/ruby MAINTAINER Deepak Kannan "email@example.com" RUN ./bin/rails s
let us say it is called
which we build with
docker build -t deepak/app Dockerfile.app
then i get the error
Uploading context 0 bytes Error build: EOF EOF
5 Solutions collect form web for “not able to build a specific Dockerfile”
docker build -f MyDockerfile .
or with a tag:
docker build -t mysuperimage -f MyDockerfile .
The last parameter to docker build is the build path, when you put
. it means this is the path where you will find the
Dockerfile. When you change it to
Dockerfile.app it will then try and look for
Dockerfile.app/Dockerfile, which isn’t correct.
I’m not sure if it will still work, but you used to be able to do this.
$ docker build -t deepak/app - < Dockerfile.app
Try that and see if it helps, if not, maybe open a docker issue to add this feature back in, or update the documentation on how to use a Dockerfile with a different name.
More info here: http://docs.docker.io/en/latest/commandline/command/build/
docker build doronaviguy/helloworld -f SomeDockerFile .
Docker build Documentation
You can acheive this also using docker-compose.
In your docker-compose.yml under the build section, you can specify the directory in which you store your dockerfile and its alternate-name as follow :
build: context: "/path/to/docker/directory" dockerfile: "dockerfile-alternate-name"
Try dockerfeed. It uses the docker feature to build a context via stdin. I wrote the script to address exactly your problem I was facing myself.
To replace a Dockerfile with a different one you do it like this:
dockerfeed -d Dockerfile.app . | docker build -t deepak/ruby -
And voilà. Dockerfeed is doing the same as
docker build. It packs the source with its Dockerfile but lets you swap out the old Dockerfile with the desired one. No files are created in the process, no source is changed. The generated tar archive is piped into docker, which in turn sends it down to the docker daemon.
This was a valid answer in the old days when there was no
-f switch available. With docker version 1.5 this option was introduced. Now you can build provide a different Dockerfile like this:
docker build -f other-Dockerfile .