Answers: <p>You last issue is the easiest to answer because it's part of the <a href="https://laravel.com/docs/10.x/sail#configuring-a-shell-alias" rel="nofollow noreferrer">setup</a> for sail that you likely just missed. When you initially ran your installation, the last terminal message would have been something like:</p>
  <blockquote>
  <p>Thank you! We hope you build something incredible. Dive in with: cd example-app &amp;&amp; ./vendor/bin/sail up</p>
  </blockquote>
  <p>As you can see, the <code>sail</code> you want is located in the vendor files that were installed when composer was run. Adding the following to your computer's config file will bridge the gap.</p>
  <pre><code>alias sail='[ -f sail ] &amp;&amp; sh sail || sh vendor/bin/sail'
  </code></pre>
  <p>The issue about <code>service &quot;app&quot; is not running container #1</code> arises because Laravel renames the container service in the <code>docker-compose.yml</code> file. You can see the service is named <code>laravel.test</code>. If you were to run, for example:</p>
  <pre><code>docker compose exec laravel.test php artisan optimize
  </code></pre>
  <p>Then your container's routes and config should return as cleared. Notice, too, that <code>docker compose</code> is different from <code>docker-compose</code>, which will now throw a notice that the hypenated version is being deprecated.</p>
  <p>However, the reason why you'll want to configure your shell alias in your computer's config file (<em>.zshrc</em> or <em>.bashrc</em>) is that you can replace the first 5 sections with <code>sail</code> to run the command on your container, as opposed to your local machine, i.e.</p>
  <pre><code>sail artisan optimize
  </code></pre>
  <p>This is very convenient if, for example, you need your container to run on a different version of PHP than your local machine. Using the <code>sail</code> alias, or even the full path <code>./vendor/bin/sail</code>, to run your Composer and Laravel commands will target the container's version of php, not your local machine's.</p>
  <p>With respect to the <code>WWWGROUP</code> and <code>WWWUSER</code> I don't think you need to concern yourself with this message. Sail seems to take care of setting the webuser and group in the image.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-06-03T17:43:19.067Z
Answers: 2023-06-04T13:47:10.060Z
Answers: 2023-06-04T13:47:10.060Z
Answers: Paul Barthmaier
Body: <p>I just created a project in WLS with Laravel using the command:</p>
  <pre><code>curl -s https://laravel.build/example-app | bash
  </code></pre>
  <p>When trying to use the command docker-compose exec app bash it returns the this error:</p>
  <pre><code>WARN[0000] The &quot;WWWUSER&quot; variable is not set. Defaulting to a blank string.
  WARN[0000] The &quot;WWWGROUP&quot; variable is not set. Defaulting to a blank string.
  service &quot;app&quot; is not running container #1
  Looking in Docker, sail-8.2/app is running normally.
  </code></pre>
  <p>Also when trying to use commands using sail returns this:</p>
  <pre><code>Command 'sail' not found, but can be installed with:
  sudo apt install bsdgames
  </code></pre>
  
Tags: <docker>
Title: Docker WWWUSER e "WWWGROUP variable is not set
UserDisplayName: André
ThreadText: # Docker WWWUSER e "WWWGROUP variable is not set
  
  (Asked by: username_0 on 2023-05-30)
  
  I just created a project in WLS with Laravel using the command:
  
  ```
  curl -s https://laravel.build/example-app | bash
  
  ```
  
  When trying to use the command docker-compose exec app bash it returns the this error:
  
  ```
  WARN[0000] The "WWWUSER" variable is not set. Defaulting to a blank string.
  WARN[0000] The "WWWGROUP" variable is not set. Defaulting to a blank string.
  service "app" is not running container #1
  Looking in Docker, sail-8.2/app is running normally.
  
  ```
  
  Also when trying to use commands using sail returns this:
  
  ```
  Command 'sail' not found, but can be installed with:
  sudo apt install bsdgames
  
  ```
  
  **Tags:** docker
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-06-03. Score: 0
  
  You last issue is the easiest to answer because it's part of the [setup](https://laravel.com/docs/10.x/sail#configuring-a-shell-alias) for sail that you likely just missed. When you initially ran your installation, the last terminal message would have been something like:
  
  > Thank you! We hope you build something incredible. Dive in with: cd example-app && ./vendor/bin/sail up
  
  As you can see, the `sail` you want is located in the vendor files that were installed when composer was run. Adding the following to your computer's config file will bridge the gap.
  
  ```
  alias sail='[ -f sail ] && sh sail || sh vendor/bin/sail'
  
  ```
  
  The issue about `service "app" is not running container #1` arises because Laravel renames the container service in the `docker-compose.yml` file. You can see the service is named `laravel.test`. If you were to run, for example:
  
  ```
  docker compose exec laravel.test php artisan optimize
  
  ```
  
  Then your container's routes and config should return as cleared. Notice, too, that `docker compose` is different from `docker-compose`, which will now throw a notice that the hypenated version is being deprecated.
  
  However, the reason why you'll want to configure your shell alias in your computer's config file (*.zshrc* or *.bashrc*) is that you can replace the first 5 sections with `sail` to run the command on your container, as opposed to your local machine, i.e.
  
  ```
  sail artisan optimize
  
  ```
  
  This is very convenient if, for example, you need your container to run on a different version of PHP than your local machine. Using the `sail` alias, or even the full path `./vendor/bin/sail`, to run your Composer and Laravel commands will target the container's version of php, not your local machine's.
  
  With respect to the `WWWGROUP` and `WWWUSER` I don't think you need to concern yourself with this message. Sail seems to take care of setting the webuser and group in the image.
  
  
  ---
  
  