Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a piece of PHP-code in which I specify Traefik labels inside a call to docker:

    $command = new Command(
        "docker run",
        [ "--name "{$userName}"",
          "-i",
          "-a stdin",
          "--network proxy", // the reverse proxy Traefik is in the proxy network
          "--label traefik.enable=true", // label for Traefik to route trafic
          "--label traefik.http.routers.{$userName}.rule = "(Host(\`student.{$serverName}\`) && Path(\`/{$userName}\`))"", //
          $studentProtoImage // image name to run
        ]

When I inspect the docker container once it runs, the Traefik label suddenly has twice \u0026 instead of twice &:

                "traefik.http.routers.stefj.rule": "Host(`student.localhost`) \u0026\u0026 Path(`/stefj`)"

I expected it to be

                "traefik.http.routers.stefj.rule": "Host(`student.localhost`) && Path(`/stefj`)"

I tried all sorts of ways to escape the &, but nothing works. The standard way of escaping in PHP with backslashes (I tried single and double backslashes) does not work. Can anyone help me out?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
491 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...