Problem creating a Dockerfile

Hey everyone, I'm working on building a custom image for the first time with Buildkit...and I really feel like I'm struggling getting COPY/ADD and RUN to work correctly. I have written Dockerfiles before...but that was under Docker v18. Now, either I can't seem to get files to copy into a layer/image or they copy and when RUN tries to hit the file it has evaporated. Here an examples of what I'm doing...

File tree

. 
|--/build
|  '- Dockerfile
'--/config
   |- conf.sh
   |- file1
   |- file2
   |- file3
   '- file4

Dockerfile:

FROM python:3.7-alpine as base
MAINTAINER ihavetheworstcommute@some.place

ARG SOMEARGS="ARE SET"
ENV SOMEENVS=$SOMEARGS

FROM base as build1
COPY ./config/conf.sh /tmp/conf.sh
RUN ls -al /tmp && sleep 15           # shows conf.sh in directory
RUN /tmp/conf.sh                      # error 127: file not found

Build command:

docker buildx build -f build/Dockerfile .

In previous attempts to just get the files moving I've used the following `COPY` and `ADD` commands with little to no success.

COPY config/* /tmp/            # this will result in copying the only the last
                               # file (out of 5)
COPY config/conf* /tmp/        # no files copied
COPY config/conf*.sh /tmp/     # no files copied
COPY config/conf.sh /tmp/      # no files copied

If I attempt to `COPY` or `ADD` to `/`, or set the `WORKDIR` then regardless of any action above no files are copied. Seriously....I feel like I'm beating my head against a brick wall. I keep going over and over the docs and feel I missing something basic here. Any suggestions are welcome!

Posted Nov 1, 2023, 3:59 PM UTC

57
Loading comments…