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
:
docker build -f .travis/debian-stretch/minion/Dockerfile .
container builds finedocker-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
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
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
?
@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.
Most helpful comment
It seems like builder try copy
project_root/.travis/debian-stretch/minion/.travis/entrypoint_minion_run.sh
. Try something like