Error: not enough unattached volumes for 'foobar_volume'

I’m trying to create a pi-hole instance with persistent storage.

This is the contents of my Dockerfile:

FROM pihole/pihole:latest

ENV INTERFACE eth0
ENV DNSMASQ_LISTENING ALL
ENV DNSMASQ_USER=root


ENTRYPOINT [ \
    "unshare", "--pid", "--fork", "--kill-child=SIGTERM", "--mount-proc", \
    "perl", "-e", "$SIG{INT}=''; $SIG{TERM}=''; exec @ARGV;", "--", \
    "/s6-init" ]

My fly.toml is

app = "flyhole-pihole"
primary_region = "atl"

This is the command I’m using to run:

fly machine run . \
  --volume /pihole_flyio_volume/:/etc/ \
  --port 53/tcp \
  --port 53/udp \
  --port 80/tcp 
  -e TZ=America/New_York \
  -e WEBPASSWORD="randompassword" \
  --region atl 
  -a flyhole-pihole

The error I get is:

Error: not enough unattached volumes for 'foobar_volume'

This is what I see when I do ‘fly volumes list’:

ID                  	STATE  	NAME               	SIZE	REGION	ZONE	ENCRYPTED	ATTACHED VM	CREATED AT
vol_od56vjp98lmvny30	created	pihole_flyio_volume	1GB 	atl   	c3f1	true     	           	7 minutes ago
vol_e628r6gxelpvwmnp	created	pihole_flyio_volume	1GB 	atl   	ca2c	true     	           	12 minutes ago

Initially I had only one volume, but it gave the same error. I thought I’d create another because 2 VMs get created.

I’ve also tried a fly.toml like:

app = "flyhole-pihole"
primary_region = "atl"

[[mounts]]
  source = "pihole_flyio_volume"
  destination = "/pihole_flyio_volume"

[[services]]
  protocol = "tcp"
  internal_port = 80

  [[services.ports]]
    port = 80

[[services]]
  protocol = "udp"
  internal_port = 53

  [[services.ports]]
    port = 53

But I got the same error. Any ideas to what is causing this error?

Hi @fweorfjfjoq

My understanding is that you just want to run 1 Machine with an attached volume, is that right?

First, a couple of things:

  • the fly.toml config file isn’t used when you create Machines using fly machine commands
  • when you run fly machine run it only creates 1 Machine, not 2

The reason you’re getting that error is because this option is misconfigured:
--volume /pihole_flyio_volume/:/etc/

the --volume option needs to be --volume <volume_name>:/path/to/mount/volume

So you could try --volume pihole_flyio_volume:/path where /path is the new directory name where you want to mount the volume.

I wouldn’t recommend using the name of an existing file system directory, like /etc to mount your volume, since the command attempts to create the directory and that will cause unexpected problems!


Extra info:
Note that volumes don’t sync up data by themselves, so you would need a way to do that if that’s a requirement.
If this app is only for running pi-hole and you want to be able to deploy this app with the fly deploy command, then you could do that instead. Your fly.toml mounts section would be something like:

[mounts]
source="pihole_flyio_volume"
destination="/mypath"

In this case fly deploy would create two Machines and attach the (unattached) volumes on first deploy. On subsequent deploys, fly deploy creates new Machines and re-attaches the volumes.

This method also works if you still only want 1 Machine by adding the --ha flag to the fly deploy command:

fly deploy --ha=false

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.