title: Laravel Seeder error Cannot write to directory "public/storage/.."
body: <p>I got this <code>DatabaseSeeder.php</code> in laravel where I create a Directory:</p>
  <pre><code>public function run()
      {
          Storage::deleteDirectory('posts');
          Storage::makeDirectory('posts');
          // Etcetera ...
      } 
  </code></pre>
  <p>And then I run</p>
  <pre><code>$ php artisan migrate:fresh --seed
  </code></pre>
  <p>This works flawlessly in my development environment (Laravel Homestead).</p>
  <p>However, if I run that same command inside a Docker container using Laradock, I get the following error:</p>
  <blockquote>
  <p>Seeding: Database\Seeders\PostsSeeder</p>
  <p>InvalidArgumentException</p>
  <p>Cannot write to directory &quot;public/storage/posts&quot;</p>
  <p>at vendor/fakerphp/faker/src/Faker/Provider/Image.php:90
  86▕     ) {
  87▕         $dir = is_null($dir) ? sys_get_temp_dir() : $dir; // GNU/Linux / OS X / Windows compatible
  88▕         // Validate directory path
  89▕         if (!is_dir($dir) || !is_writable($dir)) {   ➜  90▕             throw new \InvalidArgumentException(sprintf('Cannot write to directory
  &quot;%s&quot;', $dir));
  91▕         }
  92▕
  93▕         // Generate a random filename. Use the server address so that a file
  94▕         // generated at the same time on a different server won't have a collision.</p>
  <p>+3 vendor frames
  database/factories/ImageFactory.php:25</p>
  <p>Faker\Generator::__call()</p>
  </blockquote>
  <p>Why is this happening?</p>
  <p>How do I fix it?</p>
  <hr />
  <p><strong>Workaround</strong></p>
  <p>To easily solve it simply create those directories:</p>
  <pre><code>$ ls -lah public/
  $ cd public/ &amp;&amp; mkdir storage &amp;&amp; cd storage &amp;&amp; mkdir posts &amp;&amp; cd ../..
  </code></pre>
  <p>Try again</p>
  <pre><code>$ artisan migrate:refresh --seed
  </code></pre>