Repository: aksiksi/compose2nix (go)

Issue:
Quoting of health-cmd leads to health check failures in generated code
As seen in the referenced line of the source code, the health-cmd generated when using compose2nix is quoted using single quotes, see
https://github.com/aksiksi/compose2nix/blob/3cc5f141667c1dd434570ab6cb2dbac5739edc52/compose.go#L519.

This will lead to output looking like this in the oci-container definitions:
`--health-cmd='wget -O /dev/null -q http://localhost:7474 || exit 1'`, which will try to execute an invalid command in the container
as a health check, thus causing the health check to always fail.

The fix should be simple, just removing the quotes around `'%s'`.


Pull request description:
fix: do not wrap --health-cmd in quotes
We cannot wrap the health command with single quotes because Nix calls `escapeShellArg` under the hood on each entry in the `ExtraOptions` array.

This results in us passing in the single-quote wrapped command as-is - i.e., including single quotes - to the runtime, which causes the entire quote-enclosed string to be interpreted as an *executable* rather than a shell command.

I have also added a simple health check to the integration test.

Fixes #22.

Patch:
diff --git a/compose.go b/compose.go
index 64affd7..7e14b3d 100644
--- a/compose.go
+++ b/compose.go
@@ -516,7 +516,7 @@ func (g *Generator) buildNixContainer(service types.ServiceConfig, networkMap ma
 				cmd = strings.ReplaceAll(cmd, `"`, `\"`)
 				cmd = strings.ReplaceAll(cmd, "${", `\${`)
 
-				c.ExtraOptions = append(c.ExtraOptions, fmt.Sprintf("--health-cmd='%s'", cmd))
+				c.ExtraOptions = append(c.ExtraOptions, fmt.Sprintf("--health-cmd=%s", cmd))
 			}
 			if timeout := healthCheck.Timeout; timeout != nil {
 				c.ExtraOptions = append(c.ExtraOptions, fmt.Sprintf("--health-timeout=%v", *timeout))


Test patch:
diff --git a/nixos-test/docker-compose.nix b/nixos-test/docker-compose.nix
index 48f88f0..e34251c 100644
--- a/nixos-test/docker-compose.nix
+++ b/nixos-test/docker-compose.nix
@@ -1,4 +1,4 @@
-# Auto-generated using compose2nix v0.1.9.
+# Auto-generated using compose2nix v0.2.0-pre.
 { pkgs, lib, ... }:
 
 {
@@ -69,6 +69,7 @@
     ];
     log-driver = "journald";
     extraOptions = [
+      "--health-cmd=echo abc && true"
       "--ip=192.168.8.20"
       "--network-alias=service-b"
       "--network=myproject_something"
diff --git a/nixos-test/docker-compose.yml b/nixos-test/docker-compose.yml
index 94f769a..c83323a 100644
--- a/nixos-test/docker-compose.yml
+++ b/nixos-test/docker-compose.yml
@@ -29,6 +29,8 @@ services:
       - "compose2nix.systemd.service.RuntimeMaxSec=360"
     depends_on:
       - service-a
+    healthcheck:
+      test: echo abc && true
     networks:
       something:
         ipv4_address: 192.168.8.20
diff --git a/nixos-test/podman-compose.nix b/nixos-test/podman-compose.nix
index 8114f95..50eb19f 100644
--- a/nixos-test/podman-compose.nix
+++ b/nixos-test/podman-compose.nix
@@ -1,4 +1,4 @@
-# Auto-generated using compose2nix v0.1.9.
+# Auto-generated using compose2nix v0.2.0-pre.
 { pkgs, lib, ... }:
 
 {
@@ -71,6 +71,7 @@
     ];
     log-driver = "journald";
     extraOptions = [
+      "--health-cmd=echo abc && true"
       "--ip=192.168.8.20"
       "--network-alias=service-b"
       "--network=myproject_something"
diff --git a/nixos-test/test.nix b/nixos-test/test.nix
index 2e4fe29..b3bd5f5 100644
--- a/nixos-test/test.nix
+++ b/nixos-test/test.nix
@@ -15,6 +15,7 @@ let
     virtualisation.graphics = false;
     virtualisation.oci-containers.containers."myproject-service-a".imageFile = nginxImage;
     virtualisation.oci-containers.containers."service-b".imageFile = nginxImage;
+    environment.systemPackages = [ pkgs.jq ];
     system.stateVersion = "23.05";
   };
 in
@@ -51,5 +52,8 @@ in
       # Wait for container services.
       m.wait_for_unit(f"{runtime}-myproject-service-a.service")
       m.wait_for_unit(f"{runtime}-service-b.service")
+
+      # Wait until the health check succeeds.
+      m.wait_until_succeeds(f"{runtime} inspect service-b | jq .[0].State.Health.Status | grep healthy", timeout=30)
   '';
 }
diff --git a/testdata/TestBasic.docker.nix b/testdata/TestBasic.docker.nix
index ae6621c..1a2c9ca 100644
--- a/testdata/TestBasic.docker.nix
+++ b/testdata/TestBasic.docker.nix
@@ -35,7 +35,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -91,7 +91,7 @@
     };
     log-driver = "journald";
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -143,7 +143,7 @@
     user = "1000:1000";
     log-driver = "journald";
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestBasic.podman.nix b/testdata/TestBasic.podman.nix
index d179fbc..3bcd2cd 100644
--- a/testdata/TestBasic.podman.nix
+++ b/testdata/TestBasic.podman.nix
@@ -40,7 +40,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -94,7 +94,7 @@
     };
     log-driver = "journald";
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -143,7 +143,7 @@
     user = "1000:1000";
     log-driver = "journald";
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"
diff --git a/testdata/TestEnvFilesOnly.docker.nix b/testdata/TestEnvFilesOnly.docker.nix
index dee91ab..bb2847c 100644
--- a/testdata/TestEnvFilesOnly.docker.nix
+++ b/testdata/TestEnvFilesOnly.docker.nix
@@ -34,7 +34,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -85,7 +85,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -133,7 +133,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestEnvFilesOnly.podman.nix b/testdata/TestEnvFilesOnly.podman.nix
index e03ad8f..880958c 100644
--- a/testdata/TestEnvFilesOnly.podman.nix
+++ b/testdata/TestEnvFilesOnly.podman.nix
@@ -39,7 +39,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -88,7 +88,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -133,7 +133,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"
diff --git a/testdata/TestNoWriteNixSetup.docker.nix b/testdata/TestNoWriteNixSetup.docker.nix
index 5840c23..010c6ad 100644
--- a/testdata/TestNoWriteNixSetup.docker.nix
+++ b/testdata/TestNoWriteNixSetup.docker.nix
@@ -30,7 +30,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -87,7 +87,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -140,7 +140,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestNoWriteNixSetup.podman.nix b/testdata/TestNoWriteNixSetup.podman.nix
index 8d9d26a..e82ed3a 100644
--- a/testdata/TestNoWriteNixSetup.podman.nix
+++ b/testdata/TestNoWriteNixSetup.podman.nix
@@ -30,7 +30,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -85,7 +85,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -135,7 +135,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"
diff --git a/testdata/TestOverrideSystemdStopTimeout.docker.nix b/testdata/TestOverrideSystemdStopTimeout.docker.nix
index f0a4738..f4f856e 100644
--- a/testdata/TestOverrideSystemdStopTimeout.docker.nix
+++ b/testdata/TestOverrideSystemdStopTimeout.docker.nix
@@ -36,7 +36,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -94,7 +94,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -148,7 +148,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestOverrideSystemdStopTimeout.podman.nix b/testdata/TestOverrideSystemdStopTimeout.podman.nix
index c059689..b8d2d00 100644
--- a/testdata/TestOverrideSystemdStopTimeout.podman.nix
+++ b/testdata/TestOverrideSystemdStopTimeout.podman.nix
@@ -41,7 +41,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -97,7 +97,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -148,7 +148,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"
diff --git a/testdata/TestProject.docker.nix b/testdata/TestProject.docker.nix
index 54c426a..a50133c 100644
--- a/testdata/TestProject.docker.nix
+++ b/testdata/TestProject.docker.nix
@@ -36,7 +36,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -93,7 +93,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -146,7 +146,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestProject.podman.nix b/testdata/TestProject.podman.nix
index 27a5eaa..20820e2 100644
--- a/testdata/TestProject.podman.nix
+++ b/testdata/TestProject.podman.nix
@@ -41,7 +41,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -96,7 +96,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -146,7 +146,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"
diff --git a/testdata/TestRemoveVolumes.docker.nix b/testdata/TestRemoveVolumes.docker.nix
index 4b4f941..251907a 100644
--- a/testdata/TestRemoveVolumes.docker.nix
+++ b/testdata/TestRemoveVolumes.docker.nix
@@ -36,7 +36,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -93,7 +93,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -146,7 +146,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestRemoveVolumes.podman.nix b/testdata/TestRemoveVolumes.podman.nix
index 3d13fc8..1c1533e 100644
--- a/testdata/TestRemoveVolumes.podman.nix
+++ b/testdata/TestRemoveVolumes.podman.nix
@@ -41,7 +41,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -96,7 +96,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -146,7 +146,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"
diff --git a/testdata/TestSystemdMount.docker.nix b/testdata/TestSystemdMount.docker.nix
index 16f0d41..ed6f6aa 100644
--- a/testdata/TestSystemdMount.docker.nix
+++ b/testdata/TestSystemdMount.docker.nix
@@ -36,7 +36,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -96,7 +96,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -152,7 +152,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestSystemdMount.podman.nix b/testdata/TestSystemdMount.podman.nix
index fe6e6b8..b55fa95 100644
--- a/testdata/TestSystemdMount.podman.nix
+++ b/testdata/TestSystemdMount.podman.nix
@@ -41,7 +41,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -99,7 +99,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -152,7 +152,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"
diff --git a/testdata/TestUpheldBy.docker.nix b/testdata/TestUpheldBy.docker.nix
index 32351f1..8ca7dcf 100644
--- a/testdata/TestUpheldBy.docker.nix
+++ b/testdata/TestUpheldBy.docker.nix
@@ -36,7 +36,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -96,7 +96,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -149,7 +149,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-period=40s"
diff --git a/testdata/TestUpheldBy.podman.nix b/testdata/TestUpheldBy.podman.nix
index 698ecbe..948c509 100644
--- a/testdata/TestUpheldBy.podman.nix
+++ b/testdata/TestUpheldBy.podman.nix
@@ -41,7 +41,7 @@
       "--cpu-quota=1.5"
       "--cpus=1"
       "--dns=1.1.1.1"
-      "--health-cmd='curl -f http://localhost/\${POTATO}'"
+      "--health-cmd=curl -f http://localhost/\${POTATO}"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
       "--log-opt=max-size=10m"
@@ -99,7 +99,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='curl -f http://localhost/'"
+      "--health-cmd=curl -f http://localhost/"
       "--hostname=sabnzbd"
       "--log-opt=compress=true"
       "--log-opt=max-file=3"
@@ -149,7 +149,7 @@
     log-driver = "journald";
     autoStart = false;
     extraOptions = [
-      "--health-cmd='[\"curl\",\"-f\",\"http://localhost\"]'"
+      "--health-cmd=[\"curl\",\"-f\",\"http://localhost\"]"
       "--health-interval=1m30s"
       "--health-retries=3"
       "--health-start-interval=5s"