Skip to content

kamal proxy - can't boot with a sysctl with a quoted string #1448

@mdkent

Description

@mdkent

After issuing:

$ kamal proxy boot_config set -d staging --docker-options='sysctl net.ipv4.ip_local_port_range="10000 60999"'

we get the correct setting on disk:

$ kamal proxy boot_config get -d staging
<snip>
Host foo-cable-app-01: --publish 80:80 --publish 443:443 --log-opt max-size=10m --sysctl net.ipv4.ip_local_port_range="10000 60999"

but we can't boot it:

$ kamal proxy reboot --rolling -d staging
<snip>
  INFO [57d18bc1] Running docker run --name kamal-proxy --network kamal --detach --restart unless-stopped --volume kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy $(cat .kamal/proxy/options || echo "--publish 80:80 --publish 443:443 --log-opt max-size=10m") basecamp/kamal-proxy:v0.8.4 on foo-cable-app-01
Releasing the deploy lock...
  ERROR (SSHKit::Command::Failed): Exception while executing on host foo-cable-app-01: docker exit status: 125
docker stdout: Nothing written
docker stderr: docker: invalid reference format.
See 'docker run --help'.

looks like the quoting coming out of the shell expansion is messing it up:

$ set -x; docker run --name kamal-proxy --network kamal --detach --restart unless-stopped --volume kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy $(cat .kamal/proxy/options || echo "--publish 80:80 --publish 443:443 --log-opt max-size=10m") basecamp/kamal-proxy:v0.8.4;
++ cat .kamal/proxy/options
+ docker run --name kamal-proxy --network kamal --detach --restart unless-stopped --volume kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy --publish 80:80 --publish 443:443 --log-opt max-size=10m --sysctl 'net.ipv4.ip_local_port_range="10000' '60999"' basecamp/kamal-proxy:v0.8.4
docker: invalid reference format.
See 'docker run --help'.

note the quoting on

--sysctl 'net.ipv4.ip_local_port_range="10000' '60999"'

I've tried all manor of quoting here without luck, the only real fix seems to be to full resolve the entire command first, eg:

$ x="docker run --name kamal-proxy --network kamal --detach --restart unless-stopped --volume kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy $(cat .kamal/proxy/options || echo "--publish 80:80 --publish 443:443 --log-opt max-size=10m") basecamp/kamal-proxy:v0.8.4"
$ echo $x
docker run --name kamal-proxy --network kamal --detach --restart unless-stopped --volume kamal-proxy-config:/home/kamal-proxy/.config/kamal-proxy --publish 80:80 --publish 443:443 --log-opt max-size=10m --sysctl net.ipv4.ip_local_port_range="10000 60999" basecamp/kamal-proxy:v0.8.4
$ eval $x
835ee1d64bcffbb114e3193f763eb93f11f407f8f40e09a9e1d14054dbcce75c

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions