Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to COPY via docker-compose #5431

Closed
kiemlicz opened this issue Dec 3, 2017 · 3 comments
Closed

Unable to COPY via docker-compose #5431

kiemlicz opened this issue Dec 3, 2017 · 3 comments

Comments

@kiemlicz
Copy link

kiemlicz commented Dec 3, 2017

Having following project structure:

project_root/.travis/debian-stretch/minion/Dockerfile

FROM debian:stretch
COPY .travis/entrypoint_minion_run.sh /opt/
COPY .travis/config/minion.conf /etc/salt/minion.d/minion.conf
COPY .travis/config/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN apt-get update && \
    apt-get install -y curl supervisor && \
    curl -L https://bootstrap.saltstack.com | sh

ENTRYPOINT ["/opt/entrypoint_minion_run.sh"]

project_root/.travis/debian-stretch/docker-compose.yml

version: '3.4'
services:
  master:
    build: .travis/debian-stretch/master
    hostname: master
    domainname: public.com
    ports:
     - "4505:4505"
     - "4506:4506"
    links:
      - minion1
      - minion2
      - minion3
  minion1:
    build: .travis/debian-stretch/minion
    hostname: minion1
    domainname: public.com
  minion2:
    build: .travis/debian-stretch/minion
    hostname: minion2
    domainname: public.com
  minion3:
    build: .travis/debian-stretch/minion
    hostname: minion3
    domainname: public.com

From project_root:

  • I can run docker build -f .travis/debian-stretch/minion/Dockerfile . container builds fine
  • I can't run: docker-compose -f .travis/debian-stretch/docker-compose.yml --project-directory=. build minion1

I get following failure:

Building minion1
Step 1/6 : FROM debian:stretch
 ---> 6d83de432e98
Step 2/6 : COPY .travis/entrypoint_minion_run.sh /opt/
ERROR: Service 'minion1' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder127631070/.travis/entrypoint_minion_run.sh: no such file or directory

Of course the entrypoint_minion_run.sh exists under project_root/.travis/entrypoint_minion_run.sh

Is it a bug or is it something wrong with my docker-compose.yml or my setup?

My docker-ce version: Docker version 17.09.0-ce, build afdb6d4
My docker-compose version: docker-compose version 1.17.1, build 6d101fb

@VolCh
Copy link

VolCh commented Dec 4, 2017

It seems like builder try copy project_root/.travis/debian-stretch/minion/.travis/entrypoint_minion_run.sh. Try something like

minion1:
  build:
    context: .
    dockerfile: .travis/debian-stretch/minion/Dockerfile

@kiemlicz
Copy link
Author

kiemlicz commented Dec 4, 2017

It works the way you've suggested.
Thank you!

Question is: shouldn't it work without this change, invoked like so: docker-compose -f .travis/debian-stretch/docker-compose.yml --project-directory=. build ?

@shin-
Copy link

shin- commented Dec 4, 2017

@kiemlicz When you write

build: .travis/debian-stretch/master

it's equivalent to

build:
  context: .travis/debian-stretch/master
  dockerfile: Dockerfile

THe --project-directory directive doesn't affect that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants