{"action":"created","issue":{"url":"https://api.github.com/repos/docker/compose/issues/1398","labels_url":"https://api.github.com/repos/docker/compose/issues/1398/labels{/name}","comments_url":"https://api.github.com/repos/docker/compose/issues/1398/comments","events_url":"https://api.github.com/repos/docker/compose/issues/1398/events","html_url":"https://github.com/docker/compose/issues/1398","id":74368388,"number":1398,"title":"Dockerfile ADD relative path when initiated from docker-compose build","user":{"login":"jjoubert","id":525553,"avatar_url":"https://avatars.githubusercontent.com/u/525553?v=3","gravatar_id":"","url":"https://api.github.com/users/jjoubert","html_url":"https://github.com/jjoubert","followers_url":"https://api.github.com/users/jjoubert/followers","following_url":"https://api.github.com/users/jjoubert/following{/other_user}","gists_url":"https://api.github.com/users/jjoubert/gists{/gist_id}","starred_url":"https://api.github.com/users/jjoubert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jjoubert/subscriptions","organizations_url":"https://api.github.com/users/jjoubert/orgs","repos_url":"https://api.github.com/users/jjoubert/repos","events_url":"https://api.github.com/users/jjoubert/events{/privacy}","received_events_url":"https://api.github.com/users/jjoubert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-08T13:42:01Z","updated_at":"2015-05-08T14:40:40Z","closed_at":null,"body":"Please consider the example where I have a Dockerfile in a specific directory including an ADD operation with a relative path to the target.  \r\nSomething like this:  /a/b/c/Dockerfile:\r\n\r\n    FROM base\r\n    ADD ../b/file.txt\r\n\r\nThis image builds correctly if I just run docker build in the same directory as the Dockerfile (/a/b/c/).\r\n\r\nNow, let's say I have a docker-compose.yml file in a higher-level with a relative path to the Dockerfile:  /a/docker-compose.yml:\r\n\r\n    myimage:\r\n      build: ./b/c/\r\n\r\nIt seems to me that if I run (up) on this docker-compose.yml, the build context path for the Dockerfile is the path of the docker-compose.yml, in other words, the relative path to \"file.txt\" in my Dockerfile does not resolve correctly.\r\nIs this expected?  Is there a way for me to override this behaviour without re-arranging the structure?  In other words, force the build context path to be the path of the Dockerfile regardless of where the docker-compose.yml file is?\r\n\r\nMy current situation is that the top-level docker-compose actually reference a number of lower-level Dockerfiles."},"comment":{"url":"https://api.github.com/repos/docker/compose/issues/comments/100253591","html_url":"https://github.com/docker/compose/issues/1398#issuecomment-100253591","issue_url":"https://api.github.com/repos/docker/compose/issues/1398","id":100253591,"user":{"login":"Kosta-Github","id":2526664,"avatar_url":"https://avatars.githubusercontent.com/u/2526664?v=3","gravatar_id":"","url":"https://api.github.com/users/Kosta-Github","html_url":"https://github.com/Kosta-Github","followers_url":"https://api.github.com/users/Kosta-Github/followers","following_url":"https://api.github.com/users/Kosta-Github/following{/other_user}","gists_url":"https://api.github.com/users/Kosta-Github/gists{/gist_id}","starred_url":"https://api.github.com/users/Kosta-Github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kosta-Github/subscriptions","organizations_url":"https://api.github.com/users/Kosta-Github/orgs","repos_url":"https://api.github.com/users/Kosta-Github/repos","events_url":"https://api.github.com/users/Kosta-Github/events{/privacy}","received_events_url":"https://api.github.com/users/Kosta-Github/received_events","type":"User","site_admin":false},"created_at":"2015-05-08T14:40:40Z","updated_at":"2015-05-08T14:40:40Z","body":"See docker documentation (https://docs.docker.com/reference/builder/):\r\n```\r\nWarning Avoid using your root directory, /, as the root of the source repository. The docker build command will use whatever directory contains the Dockerfile as the build context (including all of its subdirectories). The build context will be sent to the Docker daemon before building the image, which means if you use / as the source repository, the entire contents of your hard drive will get sent to the daemon (and thus to the machine running the daemon). You probably don't want that.\r\n```\r\nand\r\n```\r\nThe <src> path must be inside the context of the build; you cannot ADD ../something /something, because the first step of a docker build is to send the context directory (and subdirectories) to the docker daemon.\r\n```\r\n"}}