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

Docker fails to execute docker-entrypoint.sh if an image was built in Windows #5620

Closed
dobromyslov opened this issue Mar 4, 2023 · 8 comments
Labels

Comments

@dobromyslov
Copy link

Describe the bug

  1. Some developers on Windows use the auto CRLF option in Git, and Git converts line endings to CRLF.
  2. docker-entrypoint.sh files are also affected by such conversion.
  3. Docker image built on Windows can't run docker-entrypoint.sh with CRLF line endings:
[FATAL tini (7)] exec /docker-entrypoint.sh failed: No such file or directory

To Reproduce
Steps to reproduce the behavior:

  1. Use Windows
  2. Enable the auto CRLF option with git config --global core.autocrlf true
  3. Git clone the n8n repository (Git converts all line endings to CRLF)
  4. Build the docker image
  5. Run the docker image
  6. See the error [FATAL tini (7)] exec /docker-entrypoint.sh failed: No such file or directory.

Expected behavior

I expect

  • the n8n repo to have its own settings for line endings
  • and Git not to convert line endings of the .sh files.

We can achieve this with the following config in the .gitattributes file:

*.sh text eol=lf

Environment (please complete the following information):

  • OS: Windows
  • n8n docker image built on Windows

Workaround

git config --global core.autocrlf input
git rm --cached -r .
git reset --hard
@Joffcom
Copy link
Member

Joffcom commented Mar 6, 2023

Hey @dobromyslov,

Thanks for reporting this one, It looks like a fairly quick fix. I will have a chat with the team to see if there is any possible downside to doing this.

@sdghf
Copy link

sdghf commented Mar 16, 2023

Hey @Joffcom I have also encountered this problem. After packaging the image on Windows and Mac, I uploaded it to my own image repository. However, I also encountered errors when running it through Potainer. I also tried to build and run the image using Drone, but encountered errors. Additionally, our own image size seems to be much smaller than the images on Docker Hub, so I'm trying to understand how you package the images.

@sdghf
Copy link

sdghf commented Mar 16, 2023

Hey @Joffcom
This is a problem that occurs when running on Portainer, but there is no error when using the official image.
image
image

@Joffcom
Copy link
Member

Joffcom commented Mar 16, 2023

Hey @sdghf

Did you try the fix mentioned? Rather than using portainer what happens if you just use the docker run command?

Have you also checked that your build is creating an image for the correct cpu type? I know if I make a custom image on my M1 Mac it won't work on my nuc because I am not building an amd64 image.

I would also expect a custom image to be a lot bigger like 700mb - 1GB, can you share the exact command you are using to build the image and any changes you have made that require a custom image.

@sdghf
Copy link

sdghf commented Mar 16, 2023

Hey @Joffcom

If running docker run locally is not an issue, but I want to deploy it to a server. I have tried to fix it, but the error still occurs.

I know it's probably a CPU type issue, but I don't know how to build the correct image for the CPU type.

I packaged the image using docker/images/n8n-custom. I made some simple code modifications to adapt it to our own business, so I must create a custom image.

@Joffcom
Copy link
Member

Joffcom commented Mar 16, 2023

Hey @sdghf,

Can you confirm what CPU you are building on and what CPU you are deploying on? If you are making a custom image for another CPU you would need to use something buildx to pass in the platforms but that is not something I have instructions for and you would need to do a bit of digging through the docker docs for that one.

@Joffcom
Copy link
Member

Joffcom commented Jun 15, 2023

Hey @dobromyslov,

I have just popped in a PR which should fix this once merged, Thanks for raising this one. For now I am going to mark this one as closed if you still find it is an issue let me know and we can open it again.

@Joffcom Joffcom closed this as completed Jun 15, 2023
@janober
Copy link
Member

janober commented Jun 22, 2023

Fix got released with [email protected]

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

No branches or pull requests

4 participants