-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fails when /var/log
is a tmpfs
#1663
Comments
I'm not able to test it right now, but did you try to create a tmpfs mount on the host system ( volumes:
- './etc-pihole:/etc/pihole'
- './etc-dnsmasq.d:/etc/dnsmasq.d'
- '/mytmpfsdir:/var/log' <------- |
I don't think that mode is valid. https://docs.docker.com/reference/compose-file/services/#long-syntax-5 And you don't need the single quotes for the Can you run an inspection to see how the mounts are being created? You can
|
Thanks for the fast responses!
That worked! Is this expected behavior? I can make this work for my solution whether this is expected behavior or not (I imagine this is more of a docker question than a "your pihole docker container implementation" question, but I could be wrong. In response to @dschaper:
Here's what I got (without implementing @rdwebdesign's solution): [{"Type":"bind","Source":"/home/george/Desktop/pihole/etc-pihole","Destination":"/etc/pihole","Mode":"rw","RW":true,"Propagation":"rprivate"},{"Type":"bind","Source":"/home/george/Desktop/pihole/etc-dnsmasq.d","Destination":"/etc/dnsmasq.d","Mode":"rw","RW":true,"Propagation":"rprivate"},{"Type":"volume","Name":"pihole_run_vol","Source":"/var/lib/docker/volumes/pihole_run_vol/_data","Destination":"/run","Driver":"local","Mode":"z","RW":true,"Propagation":""},{"Type":"tmpfs","Source":"","Destination":"/var/log","Mode":"","RW":true,"Propagation":""}] |
Okay, that looks like it's being created. Try removing the tmpfs:
mode: 0o777 The default mode for a https://docs.docker.com/engine/storage/tmpfs/#specify-tmpfs-options
|
@dschaper, the permissions of these folders/files are actually in octal (0o...), not hexadecimal (0x...). Each digit represents three bits, so 0b000 through 0b111 is 0-7 (eight possibilities). If each one were four bits and could range from 0x0 (0b0000) to 0xF (0b1111), then they would be hex. You are correct that putting 777 results in In either case, we can count this issue as closed. @rdwebdesign's answer did, in fact, work! However, I'm a bit sad because it looks like docker does not copy existing contents of a folder into a tmpfs when creating a tmpfs on top of an existing folder. In case anyone wants to see a simple demonstration of this: # Dockerfile
FROM alpine:latest
RUN mkdir -p /home/regMount
RUN mkdir -p /home/tmpMountVolumesSection
RUN mkdir -p /home/tmpfsSectionMount
RUN mkdir -p /home/tmpfsVolumeType
RUN touch /home/regMount/testFileFromDockerfile
RUN touch /home/tmpMountVolumesSection/testFileFromDockerfile
RUN touch /home/tmpfsSectionMount/testFileFromDockerfile
RUN touch /home/tmpfsVolumeType/testFileFromDockerfile
# Keep the container running
CMD ["tail", "-f", "/dev/null"] # docker-compose.yml
services:
idle:
build: .
container_name: tfs
volumes:
- ./regDir:/home/regMount
- my_tempfs:/home/tmpMountVolumesSection
- type: tmpfs
target: '/home/tmpfsVolumeType'
tmpfs:
mode: 777
volume:
nocopy: false
tmpfs:
- /home/tmpfsSectionMount
volumes:
my_tempfs:
driver_opts:
type: tmpfs
device: tmpfs Notice that any of the three methods of mounting a tmpfs volume on top of a directory that already has stuff in it will clobber the contents of that directory. Very sad. But alas, a docker problem (likely intended behavior but I don't like it so I'm going to call it a problem), not a pi-hole problem. Thanks to both of you for your time! |
I'm trying to mount some log directories as tmpfs to avoid constant writes to storage.
This is a: Run Issue
Details
I've tried many styles of setting
/var/log
as a tmpfs within my docker compose file, but all of them seem to result in the contents of/var/log
being clobbered after being set up. For instance, every second lighttpd fails because there is no/var/log/lighttpd
directory. These messages get barfed to docker's log:I can
docker exec -it -u www-data pihole /bin/bash
into/var/log
andmkdir lighttpd
successfully, so this isn't a permissions issue of the tmpfs being mounted. In fact, the whole/var/log
directory looks pretty bare compared to a properly built container. I'm guessing this is because these directories are build/populated during the initial build phase, then the empty tmpfs directory gets plopped on top of the pre-build/var/log
directory without copying over its contents. However, I believe typically docker does copy over contents when it mounts these tmpfs volumes. For reference, here is my docker-compose file:You'll see three distinct methods of mounting tmpfs volumes there, one for
/tmp
, one for/run
, and one for/var/log
. The way/run
is mounted was the only way any of this would work for some reason. The other two ways do result in mounting the tmpfs appropriately (as confirmed bydf -hT
and permissions confirmed bydocker exec
experimentation as well asls -la
).Related Issues
How to reproduce the issue
These common fixes didn't work for my issue
docker run
example(s) in the readme (removing any customizations I added)If the above debugging / fixes revealed any new information note it here.
Add any other debugging steps you've taken or theories on root cause that may help.
The text was updated successfully, but these errors were encountered: