         "run",
         "--rm",
         "-w=#{@working_dir}"
-      ] ++ mounts(pkg) ++ [image | ["chown", "#{uid()}:#{gid()}", @working_dir]]
+      ] ++ env(:root) ++ mounts(pkg) ++ [image | ["chown", "#{uid()}:#{gid()}", @working_dir]]
 
     case Mix.Nerves.Utils.shell("docker", args) do
       {_result, 0} ->

        "-a",
        "stdout",
        "-a",
        "stderr",
        "--user",
        "#{uid()}:#{gid()}"
      ] ++ mounts(pkg) ++ ssh_agent() ++ [image | cmd]

    case Mix.Nerves.Utils.shell("docker", args, stream: stream) do
      {_result, 0} ->


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

    cmd =
      "docker run --rm -it -w #{@working_dir} #{env_vars} #{mounts} #{ssh_agent} #{image} /bin/bash"

    set_volume_permissions(pkg)

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

