You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered:
The dockerfile pulls ubuntu:20.04 as its base image, which includes 4.7 of
sed
. This version ofsed
has filesystem issues breaks thing when it is running in a Docker image. If this version ofsed
is run on a file that is mounted to the Docker image, it does not work, whether or notsed
is run with-i
or if youchmod 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:
docker build --no-cache -t usher install/
/data
within the Docker container and enter the container viadocker run -v .:/HOME/usher/data -it [whatever-id-the-image-ends-up-with]
cd
into/data
and attempt tosed -i 's/,/\n/g' some_file.txt
orsed 's/,/\n/g' some_file.txt > brand_new_temp_file.txt
The text was updated successfully, but these errors were encountered: