Skip to content

Allow Dockerfile to ignore itself #7969

@tomfotherby

Description

@tomfotherby

I have the smallest possible Dockerfile that I use to build our website:

FROM peopleperhour/supertasker
ADD . /var/www/

When I run the resulting container (which is a webserver) I get a Dockerfile at /var/www - not a problem but not the cleanest.

I thought I could solve this issue by adding a .dockerignore file (released in version 1.1):

$ cat .dockerignore
Dockerfile

However, if I do this, when I build I get a error:

$docker build -t="peopleperhour/supertasker:bd40102" .
2014/09/10 11:37:33 Dockerfile was excluded by .dockerignore pattern 'Dockerfile'

This is the Docker go code that gives the error: 27cca4c70cc7f0cccfda

It would be nice if Docker could use .dockerignore to prevent adding the Dockerfile to the build context. Or maybe this is a workaround?


$ uname -a
Linux helper01 3.13.0-29-generic #53-Ubuntu SMP Wed Jun 4 21:00:20 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ docker version
Client version: 1.1.2
Client API version: 1.13
Go version (client): go1.2.1
Git commit (client): d84a070
Server version: 1.1.2
Server API version: 1.13
Go version (server): go1.2.1
Git commit (server): d84a070

$ docker -D info
Containers: 90
Images: 1748
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Dirs: 1928
Execution Driver: native-0.2
Kernel Version: 3.13.0-29-generic
Debug mode (server): false
Debug mode (client): true
Fds: 20
Goroutines: 27
EventsListeners: 0
Init Path: /usr/bin/docker
Sockets: [unix:///var/run/docker.sock]
Username: pphrobot
Registry: [https://index.docker.io/v1/]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions