In Gitlab CI I'm trying to set Traefik labels while building an image in order to register it in the Traefik Service. This is how it's done:
- docker build -t $IMAGE . --label traefik.http.routers.$SERVICE_NAME.rule="Host(`$SERVICE_URL`)" --label traefik.enable=true
and this is how it is interpreted:
Step 7/7 : LABEL traefik.http.routers.socialmedia-service-master.rule=Host()
---> Running in c67fe595032a
both $SERVICE_URL and $SERVICE_NAME definitely set. How can I make it working?
Try escaping the back ticks, like so:
docker build -t $IMAGE . --label traefik.http.routers.$SERVICE_NAME.rule="Host(\`$SERVICE_URL\`)" --label traefik.enable=true