Defining context in docker compose - Error: Cannot locate specified Dockerfile: Dockerfile

docker-compose

#1
  • Goal: to use the same script cv.sh for multiple containers i’m deploying
  • Problem:
    [Info]       Building on arm02
    [Info]       Pulling previous images for caching purposes...
    [Success]    Successfully pulled cache images
    [Error]      Some services failed to build:
    [Error]        Service: cv_driver
    [Error]          Error: Cannot locate specified Dockerfile: Dockerfile
    [Error]      Not deploying release.
  • My docker-compose.yml File looks the following:
version: '2'
services:
  cv_driver:
    build:
      context: .
      dockerfile: .cv/cv_driver/Dockerfile.template
    privileged: true
    restart: always
  • My Repo looks like this
β”œβ”€β”€ cv
β”‚   β”œβ”€β”€ cv.sh
β”‚   β”œβ”€β”€ cv_driver
β”‚   β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”‚   └── Dockerfile.template
β”‚   β”œβ”€β”€ cv_logic
β”‚   β”‚   └── Dockerfile.template
└── docker-compose.yml

I tried it with referencing to cd_driver folder, the cv_driver/Dockerfile and cv_driver/Dockerfile.template


#5

Have you tried simplifying the build directive?

version: '2'
services:
  cv_driver:
    build: cv/cv_driver/Dockerfile.template
    privileged: true
    restart: always

Laurent


#6

Hello,

This is not supported yet, but we are working on it: https://github.com/resin-io/resin-builder/issues/420


#7

Wrong url in my last message, sorry: https://github.com/resin-io-modules/resin-multibuild/issues/19


#22

Okay, thanks for clarifying.

looking foreward to seeing this implemented :slight_smile:


#24

@zvin

is there an update on this issue? or any information on when it might be integrated?


#25

Hello zagatta-sonah,

Sorry I don’t have any update on this issue yet.


#30

Hello zvin,

I just wanted to give this another push, I know it’s not yet in from the PR.

I really hope we do see this feature soon, though, sharing code between containers is a pain right now :stuck_out_tongue:

Have a great day and thanks for your efforts.

Greetings, Tarek


#31

Hi, When you define a context in docker-compose, the dockerfile: bit is relative to that context. So the proper configuration would be:

test:
build:
context: …/
dockerfile: docker/cli/Dockerfile

I hope this helps…


#35

Hai,
Can u Please try this when Composing the Context in Docker file, the file should be located.
$ tree
.
β”œβ”€β”€ build
β”‚ └── etc.txt
β”œβ”€β”€ dockerfile
β”‚ └── Dockerfile.test
└── tools
└── docker
└── docker-compose.yml
Thanks,
Riya.
Docker Composer