Workspace
What is the Workspace container?
workspace is Laradock's general-purpose development shell, the container you exec into to run Composer, Artisan, Git, Node/npm, and most other CLI work against your mounted project code. It's built from the laradock/workspace base image (tagged by PHP version) and runs as a non-root laradock user matched to your host UID/GID, so files it creates aren't owned by root.
Unlike php-fpm, it's not what actually serves your app to a browser, nginx/apache talk to php-fpm for that. workspace is where you sit and type commands.
Start the Workspace
docker compose up -d workspace
Most setups start it alongside a web server and database, for example:
docker compose up -d nginx mysql workspace
Enter it
docker compose exec workspace bash
You land in /var/www (your project, mounted from APP_CODE_PATH_HOST) as the laradock user.
Stop the Workspace
docker compose stop workspace
What's installed by default
A handful of WORKSPACE_INSTALL_* / WORKSPACE_* flags in workspace/defaults.env default to true (everything else defaults to false):
| Variable | Default | What it does |
|---|---|---|
WORKSPACE_INSTALL_NODE | true | Node.js via NVM (WORKSPACE_NODE_VERSION=node tracks latest). |
WORKSPACE_INSTALL_YARN | true | Yarn package manager. |
WORKSPACE_INSTALL_NPM_GULP | true | Gulp CLI, global npm install. |
WORKSPACE_INSTALL_NPM_VUE_CLI | true | Vue CLI, global npm install. |
WORKSPACE_INSTALL_PHPREDIS | true | PHP Redis extension (for CLI scripts, Artisan, etc.). |
WORKSPACE_INSTALL_AST | true | PHP AST extension. |
WORKSPACE_INSTALL_MEMCACHED | true | PHP Memcached extension. |
WORKSPACE_INSTALL_DNSUTILS | true | dig/nslookup and friends. |
WORKSPACE_INSTALL_JDK | true | Java Development Kit. |
WORKSPACE_COMPOSER_GLOBAL_INSTALL | true | Runs composer global install at build time. |
WORKSPACE_COMPOSER_VERSION | 2 | Composer major version (1, 2, 2.2, or a specific version string). |
The WORKSPACE_INSTALL_* toggle pattern
Everything else, well over 60 tools and PHP extensions, follows the same on/off pattern in workspace/defaults.env: WORKSPACE_INSTALL_<THING>=false. Flip one to true in your .env, then rebuild:
WORKSPACE_INSTALL_XDEBUG=true
WORKSPACE_INSTALL_DRUSH=true
WORKSPACE_INSTALL_WP_CLI=true
docker compose build workspace
docker compose up -d workspace
These flags cover things like Xdebug/pcov/phpdbg, database clients (MySQL, Postgres, MSSQL), extensions (LDAP, SOAP, XSL, IMAP, SMB, Mongo, AMQP, Cassandra, ZMQ, Gearman, Swoole, Phalcon), framework tooling (Drush, Drupal Console, WP-CLI, Laravel Envoy, Laravel Installer, Symfony), package managers (pnpm, Bower, Angular CLI, npm-check-updates), and misc utilities (ImageMagick, FFmpeg, wkhtmltopdf, Terraform, Docker CLI, GitHub CLI, MinIO client, GNU Parallel, Supervisor, Oh My Zsh).
See the sections below for setup instructions on individual tools, and the PHP-FPM guide for extension-specific install/config guides (Xdebug, pcov, phpdbg, YAML, rdkafka, ionCube, etc.) that apply to workspace as well as php-fpm.
Published ports
workspace/compose.yml exposes several dev-server ports on the host, all overridable in .env:
| Variable | Default | Used for |
|---|---|---|
WORKSPACE_SSH_PORT | 2222 | SSH into the container (if WORKSPACE_INSTALL_WORKSPACE_SSH=true). |
WORKSPACE_BROWSERSYNC_HOST_PORT | 3000 | Browsersync. |
WORKSPACE_BROWSERSYNC_UI_HOST_PORT | 3001 | Browsersync UI. |
WORKSPACE_VUE_CLI_SERVE_HOST_PORT | 8080 | vue-cli-service serve. |
WORKSPACE_VUE_CLI_UI_HOST_PORT | 8001 | Vue CLI UI. |
WORKSPACE_ANGULAR_CLI_SERVE_HOST_PORT | 4200 | Angular CLI dev server. |
WORKSPACE_VITE_PORT | 5173 | Vite dev server. |
User and permissions
WORKSPACE_PUID/WORKSPACE_PGID (default 1000/1000) set the UID/GID of the laradock user inside the container. Match these to your host user if you're on Linux and hitting file-ownership mismatches on files created inside the container.
Change the PHP-CLI version
The PHP-CLI lives in the Workspace container and is used only for Artisan and Composer, it does not serve your application code (that's PHP-FPM's job), so changing it is usually optional.
- In
.env, setPHP_VERSIONto the version you want:PHP_VERSION=8.1 - Rebuild the Workspace:
docker compose build workspace
Install the rdkafka extension
Needed for composer install when your dependencies require Kafka.
- In
.env, setWORKSPACE_INSTALL_RDKAFKAtotrue. - Rebuild:
docker compose build workspace
To install rdkafka for the PHP-FPM container instead (the one that actually serves your app), see Install the rdkafka extension on the PHP-FPM guide.
Install the AST extension
AST exposes the abstract syntax tree generated by PHP 7+. It's required by tools such as Phan, a static analyzer. WORKSPACE_INSTALL_AST defaults to true, so it's already installed unless you've turned it off.
- In
.env, setWORKSPACE_INSTALL_ASTtotrue. - Rebuild:
docker compose build workspace
To pin a specific version, set
WORKSPACE_AST_VERSIONbefore rebuilding.
Node.js & NVM
- In
.env, setWORKSPACE_INSTALL_NODEtotrue. - Rebuild:
docker compose build workspace
A
.npmrcis included in theworkspacefolder and is copied into the root and laradock users' home directories on build, in case you need global npm config.
Package managers
pnpm
pnpm stores a single copy of each package version on disk and hard-links it into each project's node_modules, saving large amounts of space and speeding up installs. More on the pnpm motivation.
- In
.env, set bothWORKSPACE_INSTALL_NODEandWORKSPACE_INSTALL_PNPMtotrue. - Rebuild:
docker compose build workspace
Yarn
- In
.env, set bothWORKSPACE_INSTALL_NODEandWORKSPACE_INSTALL_YARNtotrue. - Rebuild:
docker compose build workspace
npm-check-updates
npm-check-updates upgrades your package.json dependencies to the latest versions.
- In
.env, make sureWORKSPACE_INSTALL_NODEistrue. - Set
WORKSPACE_INSTALL_NPM_CHECK_UPDATES_CLItotrue. - Rebuild:
docker compose build workspace
Frontend build tool CLIs
Gulp
- In
.env, setWORKSPACE_INSTALL_NPM_GULPtotrue. - Rebuild:
docker compose build workspace
Bower
Legacy. Bower is deprecated, prefer npm, Yarn, or pnpm for new projects.
- In
.env, setWORKSPACE_INSTALL_NPM_BOWERtotrue. - Rebuild:
docker compose build workspace
Vue CLI
- In
.env, setWORKSPACE_INSTALL_NPM_VUE_CLItotrue. - Optionally change the ports:
WORKSPACE_VUE_CLI_SERVE_HOST_PORT(default8080) andWORKSPACE_VUE_CLI_UI_HOST_PORT(default8001). - Rebuild:
docker compose build workspace
Run vue serve or vue ui from the Workspace, then browse to the matching port.
Angular CLI
- In
.env, setWORKSPACE_INSTALL_NPM_ANGULAR_CLItotrue. - Rebuild:
docker compose build workspace
Composer extras
Global Composer install
Install your global Composer requirements at build time so they're available in the container afterward.
- In
.env, setWORKSPACE_COMPOSER_GLOBAL_INSTALLtotrue. - Add your dependencies to
workspace/composer.json. - Rebuild:
docker compose build workspace
Prestissimo
Legacy. Prestissimo parallelized downloads for Composer 1 only and is abandoned. Composer 2 (Laradock's default) already downloads in parallel, so you almost certainly don't need this.
- Enable Global Composer install (steps 1-2 above).
- Add
"hirak/prestissimo": "^0.3"toworkspace/composer.json. - Rebuild:
docker compose build workspace
Deployment & task runners
Deployer
A deployment tool for PHP.
- In
.env, setWORKSPACE_INSTALL_DEPLOYERtotrue. - Rebuild:
docker compose build workspace
See the Deployer documentation.
Laravel Envoy
A task runner.
- In
.env, setWORKSPACE_INSTALL_LARAVEL_ENVOYtotrue. - Rebuild:
docker compose build workspace
See the Laravel Envoy documentation.
System utilities
Linuxbrew
Linuxbrew is the Linux port of Homebrew.
- In
.env, setWORKSPACE_INSTALL_LINUXBREWtotrue. - Rebuild:
docker compose build workspace
Supervisor
Supervisor monitors and controls long-running processes on UNIX-like systems.
- In
.env, set bothWORKSPACE_INSTALL_SUPERVISORandWORKSPACE_INSTALL_PYTHONtotrue. - Create a worker config in
php-worker/supervisord.d/by copyinglaravel-worker.conf.example. - Rebuild:
docker compose build workspace
GNU Parallel
GNU Parallel runs multiple processes concurrently from the command line.
- In
.env, setWORKSPACE_INSTALL_GNU_PARALLELtotrue. - Rebuild:
docker compose build workspace
dnsutils
- In
.env, set both flags totrue:WORKSPACE_INSTALL_DNSUTILSPHP_FPM_INSTALL_DNSUTILS
- Rebuild:
docker compose build workspace php-fpm
Media & document tools
FFmpeg
- In
.env, setWORKSPACE_INSTALL_FFMPEGtotrue. - Rebuild:
docker compose build workspace
If you queue conversions, also install FFmpeg in the php-worker and php-fpm containers (same flag pattern), otherwise the php-ffmpeg binary errors out.
BBC audiowaveform
audiowaveform generates waveform data from MP3, WAV, FLAC, or Ogg Vorbis files, for rendering visual waveforms.
- In
.env, setWORKSPACE_INSTALL_AUDIOWAVEFORMtotrue. - Rebuild:
docker compose build workspace
If you queue processing, also install it in the php-worker, laravel-horizon, and php-fpm containers (same flag pattern), otherwise the audiowaveform binary errors out.
wkhtmltopdf
wkhtmltopdf renders a PDF from HTML.
- In
.env, setWORKSPACE_INSTALL_WKHTMLTOPDFtotrue. - Rebuild:
docker compose build workspace
Also install it in the php-fpm container (same flag pattern), otherwise the wkhtmltopdf binary errors out.
poppler-utils & antiword
poppler-utils is a set of PDF command-line tools (info, text/image extraction, format conversion, signature verification, and more). It's commonly paired with antiword, so Laradock installs both together when the flag is set.
- In
.env, set the flag totruefor each container you need it in:WORKSPACE_INSTALL_POPPLER_UTILS,PHP_FPM_INSTALL_POPPLER_UTILS,PHP_WORKER_INSTALL_POPPLER_UTILS,LARAVEL_HORIZON_INSTALL_POPPLER_UTILS. - Rebuild the affected containers:
docker compose build workspace php-fpm php-worker laravel-horizon
Graphviz
Graphviz renders graphs from text descriptions. Enable it in whichever container needs it:
| Container | Flag | Rebuild |
|---|---|---|
| Workspace | WORKSPACE_INSTALL_GRAPHVIZ | docker compose build workspace |
| PHP-FPM (most common) | PHP_FPM_INSTALL_GRAPHVIZ | docker compose build php-fpm |
| PHP-Worker | PHP_WORKER_INSTALL_GRAPHVIZ | docker compose build php-worker |
Set the flag to true, then rebuild.
GitHub Copilot CLI
Requires GitHub Copilot access.
- In
.env, setWORKSPACE_INSTALL_GITHUB_CLItotrue. - Rebuild and start the Workspace:
docker compose build workspacedocker compose up -d workspace
- Enter the Workspace:
docker compose exec workspace bash
- Authenticate, then install the Copilot extension:
gh auth logingh extension install github/gh-copilot
Shell & terminal
Oh My Zsh
Oh My Zsh manages your Zsh configuration. Laradock wires it up with the Laravel autocomplete plugin.
- In
.env, setSHELL_OH_MY_ZSHtotrue. - Rebuild:
docker compose build workspace
- Use it:
docker compose exec --user=laradock workspace zsh
Configure it by editing
/home/laradock/.zshrcin the running container.
Optional plugins:
- Autosuggestions: set
SHELL_OH_MY_ZSH_AUTOSUGESTIONStotrue, then rebuild. Suggests commands as you type, from history and completions (zsh-autosuggestions). - Bash aliases: set
SHELL_OH_MY_ZSH_ALIASEStotrue, then rebuild, to load Laradock'saliases.shinto Zsh.
Git Bash prompt
A bash prompt showing the current branch, diff with remote, and counts of staged/changed files.
- In
.env, setWORKSPACE_INSTALL_GIT_PROMPTtotrue. - Rebuild:
docker compose build workspace
Customize it by editing
workspace/gitprompt.shand rebuilding. See the bash-git-prompt repo.
Terminal aliases
On startup, Laradock copies workspace/aliases.sh into the container and sources it from ~/.bashrc. Edit that file to add your own aliases or function macros.
Powerline
- In
.env, set bothWORKSPACE_INSTALL_POWERLINEandWORKSPACE_INSTALL_PYTHONtotrue(Powerline requires Python). - Rebuild:
docker compose build workspace
Common issues
- A tool you enabled isn't there.
WORKSPACE_INSTALL_*flags only take effect on build, not on a plain restart:docker compose build workspace && docker compose up -d workspace. - Files created in the container are owned by the wrong user on your host. Set
WORKSPACE_PUID/WORKSPACE_PGIDto match your host user'sid -u/id -g, then rebuild. - Composer/npm installs are painfully slow. Set
WORKSPACE_COMPOSER_REPO_PACKAGISTorWORKSPACE_NPM_REGISTRYto a closer mirror, orCHANGE_SOURCE=trueif you're behind the Great Firewall (switches apt sources to a Tsinghua mirror). - Xdebug and Blackfire both enabled, neither works right. They can't coexist in the same PHP process, the build skips the Blackfire probe entirely when
WORKSPACE_INSTALL_XDEBUG=true.
Need the container that actually runs your PHP app? See the PHP-FPM guide. New to Laradock? Start at Getting Started.