title: Laravel Sail - SQLSTATE[HY000] [2002] No such file or directory
body: <p>I followed the tutorial of <a href="https://laravel.com/docs/8.x/sail" rel="nofollow noreferrer">Laravel Sail</a> and  it is working fine, but if I clone the repo (<em>docker-compose up</em>), in another machine, I get the following error when trying to run migrations inside the container:</p>
  <blockquote>
  <p>SQLSTATE[HY000] [2002] No such file or directory (SQL: create table
  <code>migrations</code> (<code>id</code> int unsigned not null auto_increment primary key,
  <code>migration</code> varchar(255) not null, <code>batch</code> int not null) default
  character set utf8mb4 collate 'utf8mb4_unicode_ci')</p>
  </blockquote>
  <p>Already tried some solutions but nothing worked.</p>
  <p>My <strong>database.php</strong> file:</p>
  <pre><code>'mysql' =&gt; [
          'driver' =&gt; 'mysql',
          'url' =&gt; env('DATABASE_URL'),
          'host' =&gt; env('DB_HOST', '127.0.0.1'),
          'port' =&gt; env('DB_PORT', '3306'),
          'database' =&gt; env('DB_DATABASE', 'forge'),
          'username' =&gt; env('DB_USERNAME', 'forge'),
          'password' =&gt; env('DB_PASSWORD', ''),
          'unix_socket' =&gt; env('DB_SOCKET', '/var/run/mysqld/mysqld.sock'),
          'charset' =&gt; 'utf8mb4',
          'collation' =&gt; 'utf8mb4_unicode_ci',
          'prefix' =&gt; '',
          'prefix_indexes' =&gt; true,
          'strict' =&gt; true,
          'engine' =&gt; null,
          'options' =&gt; extension_loaded('pdo_mysql') ? array_filter([
              PDO::MYSQL_ATTR_SSL_CA =&gt; env('MYSQL_ATTR_SSL_CA'),
          ]) : [],
      ],
  </code></pre>
  <p>My <strong>.env</strong> file:</p>
  <pre><code>DB_CONNECTION=mysql
  DB_HOST=mysql
  DB_PORT=3306
  DB_DATABASE=code_challenge
  DB_USERNAME=root
  DB_PASSWORD=
  </code></pre>