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 image uses an old version of sed that doesn't work properly within Docker #370

Open
aofarrel opened this issue Mar 6, 2024 · 0 comments

Comments

@aofarrel
Copy link
Contributor

aofarrel commented Mar 6, 2024

The dockerfile pulls ubuntu:20.04 as its base image, which includes 4.7 of sed. This version of sed has filesystem issues breaks thing when it is running in a Docker image. If this version of sed is run on a file that is mounted to the Docker image, it does not work, whether or not sed is run with -i or if you chmod 777 the workdir, and even though the container by default runs as root. Note that this does not happen with all versions of Docker -- this is a Docker Desktop thing, but Docker Desktop is what Docker tends to push these days, so compatibility with it is important.

Ideally, a newer base image should be used, or sed should be manually updated to 4.8 somewhere in the Dockerfile.

More information

https://discourse.pi-hole.net/t/sed-couldnt-open-temporary-file-etc-pihole-sed/65159/4

To replicate

This is a known issue with sed and may not need to be replicated, but here's how I found it:

  • Have a MacOS running Docker Desktop
  • Build the image locally via docker build --no-cache -t usher install/
  • Bind the host's workdir, which contains some_file.txt, to /data within the Docker container and enter the container via docker run -v .:/HOME/usher/data -it [whatever-id-the-image-ends-up-with]
  • cd into /data and attempt to sed -i 's/,/\n/g' some_file.txt or sed 's/,/\n/g' some_file.txt > brand_new_temp_file.txt
  • Get permissions error

side note (bonus bug?)

There's a rendering error on GitHub with the second sed command. In case it shows up funky, this is what's intended:
Screenshot 2024-03-06 at 12 10 21 PM

Not:

Screenshot 2024-03-06 at 12 10 14 PM

Either way, the point is, this isn't solvable by just not using sed -i.

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

No branches or pull requests

1 participant