title: passing docker swarm secret to sibling container
body: <p>I have a docker swarm which I start with this compose file:</p>
  
  <pre><code>version: "3.1"
  
  services:
    my_service:
      image: my_image
      volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - /run/secrets:/run/secrets
      secrets:
        - my-secret
  secrets:
    my-secret:
      file: my_secret.txt
  </code></pre>
  
  <p>Now, within the container running <code>my_service</code>, I start a new sibling container (note I've mounted the docker socket), which I want to have access to <code>my-secret</code>, although it's not part of the swarm.
  What's the best way to do this?</p>
  
  <p>Simply mounting the secrets as a volume (<code>docker run -v /run/secrets:/run/secrets sibling_image</code>) doesn't work, the sibling container can see <code>my-secret</code>, but it's empty.</p>
  
  <p>Passing an environment variable works, but it's a little too cumbersome if I have many secrets: <code>docker run -it --env MY_SECRET=$(cat /run/secrets/my-secret) sibling_image</code></p>