Running a container as child of Swarm service

I need to run a container (‘child’ image) that has access to the GPU for video encode acceleration, but I also need for it to be orchestrated by Swarm. The compose file (stack file) below effectively launches the child image, but when the stack is removed, the child container is left orphaned. I’m trying to avoid running Docker-in-Docker per Jérôme Petazzoni’s excellent blog. Are there any additional labels I’m missing in order to have the child container linked to the parent service–allowing the child container to be orchestrated by Swarm via the parent service? Also submitted to stackoverflow.

version: "3.7"
services:
  parent-service:
    image: docker:stable
    entrypoint: [sh, -c]
    environment:
      TASK_NAME: '{{.Task.Name}}'
    command: >-
      'exec docker run
      --interactive
      --device=/dev/dri/renderD128:/dev/dri/renderD128
      --label com.docker.stack.namespace=$$(docker container inspect --format "{{index .Config.Labels \"com.docker.stack.namespace\"}}" $${TASK_NAME})
      --volumes-from=$${TASK_NAME}
      --rm
      child:latest'
    volumes:
      - type: bind
        source: /var/run/docker.sock
        target: /var/run/docker.sock