You have two options to run commands in your development environment:
spin exec - This executes commands in an EXISTING container (and requires that service to be already running with spin up).spin run - This executes commands in a NEW container, then exits.For example, let's say you want to run composer install in your development environment for Laravel, you would use the following command:
spin up running in a terminal window, you will need to run the spin run or spin exec command in a new terminal window from your project directory.# Usage: spin run <service> <command>
spin run php composer install
# Usage: spin exec <service> <command>
spin exec php composer install
Take note of the syntax. You specify the service you want to run the command in, then the command you want to run. The same is true for spin exec.
spin exec vs spin runIn development, it's often easier to use spin run because it will create a new container and then exit. This is faster than having to start the container with spin up and then use spin exec.
If you have something that you specifically need to run in an already running container, then you should use spin exec.
Starting Up Your Development Environment
Spin uses Docker Compose to start up your development environment in a single command. This allows you to exactly replicate your production environment for local development.
Server Requirements
Spin gives you the power to choose any host that you want. Although the responsibility is on your shoulders to get a server set up, Spin makes it very easy to get this accomplished.