not able to build a specific Dockerfile

I am able a build a Dockerfile like

docker build -t deepak/ruby .

  • Can docker port forward to a unix file socket on the host container?
  • Docker LAMP Stack
  • Zero Downtime Deployment for Micro Service architecture
  • How do I delete a docker image from docker hub via command line?
  • Get docker-compose.yml file location from running container?
  • Docker loading kernel modules
  • But for a Dockerfile which is not named Dockerfile

    # DOCKER-VERSION 0.4.8
    
    FROM deepak/ruby
    
    MAINTAINER Deepak Kannan "deepak@example.com"
    
    RUN ./bin/rails s
    

    let us say it is called Dockerfile.app
    which we build with

    docker build -t deepak/app Dockerfile.app

    then i get the error

    Uploading context 0 bytes
    Error build: EOF
    EOF
    

  • how to ignore some container when i run `docker-compose rm`
  • In docker,how to close the port expose by dockerfile?
  • How to make Flask serve the right content types for static files on Alpine?
  • How to install app from git repository via docker?
  • Mulitple Docker Containers on Port 80 with Same Domain
  • MongoDB & Docker: connections from Dockerized Mongo client to external server refused
  • 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/

    This Works

    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"
    

    docker-compose

    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.

    Update:
    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 .
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.