Why Is My Dockerfile Failing to Find Copied Files?

0
5
Asked By CuriousCactus99 On

I'm having trouble with my Dockerfile where I'm trying to copy files into a directory, but when I start the container, it can't find them. Here's what I'm doing: I have a line to create a non-root user, then I create a couple of directories. I use the COPY command to copy everything in my current context to a specific path in the container. However, when I try to run the container, I get an error that says `exec /boil/scripts/entrypoint.sh: no such file or directory`. The `entrypoint.sh` script is in the root of my repository, so it should be copied over correctly. I built the image without any issues, but now I'm stuck and can't figure out what I'm doing wrong. Can anyone help?

1 Answer

Answered By ResolvedRanger45 On

Looks like you found the issue! Just to clarify for others, make sure to check your line endings. If you're using Windows, it’s common to have CRLF line returns instead of the LF that Linux expects. Switching to LF fixed your problem. You can set this in Visual Studio Code to prevent it from happening again!

SavvySleuth87 -

Good tip! I usually run a command like `RUN ls [path]` in the Dockerfile to check the files if something doesn't work. Also, handling line endings can be a hassle, especially with Windows files—something to keep in mind for anyone using git!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.