   # Helpers
 
   defp run(pkg, cmd, stream) do
+    set_volume_permissions(pkg)
+
     {_dockerfile, image} = config(pkg)
 
     args =

        "-a",
        "stdout",
        "-a",
        "stderr"
      ] ++ mounts(pkg) ++ ssh_agent() ++ [image | cmd]

    case Mix.Nerves.Utils.shell("docker", args, stream: stream) do


    mounts = Enum.join(mounts(pkg), " ")
    ssh_agent = Enum.join(ssh_agent(), " ")

    cmd =
      "docker run --rm -it --user #{uid()}:#{gid()} -w #{@working_dir} #{mounts} #{ssh_agent} #{
        image
      }"

    set_volume_permissions(pkg)
    Mix.Nerves.Shell.open(cmd, initial_input)
  end

