Up and running with small Docker environments

Last update: Jun 29, 2022

Vessel

Up and running with small Docker dev environments.

Documentation

Full documentation can be found at https://vessel.shippingdocker.com.

Install

Vessel is just a small set of files that sets up a local Docker-based dev environment per project. There is nothing to install globally, except Docker itself!

This is all there is to using it:

composer require shipping-docker/vessel
php artisan vendor:publish --provider="Vessel\VesselServiceProvider"

# Run this once to initialize project
# Must run with "bash" until initialized
bash vessel init

./vessel start

Head to http://localhost in your browser and see your Laravel site!

Lumen

If you're using Lumen, you'll need to copy the Vessel files over manually instead of using php artisan vendor:publish. You can do this with this command:

cp -R vendor/shipping-docker/vessel/docker-files/{vessel,docker-compose.yml,docker} .

and then you'll be able to install and continue as normal.

Multiple Environments

Vessel attempts to bind to port 80 and 3306 on your machine, so you can simply go to http://localhost in your browser.

However, if you run more than one instance of Vessel, you'll get an error when starting it; Each port can only be used once. To get around this, use a different port per project by setting the APP_PORT and MYSQL_PORT environment variables in one of two ways:

Within the .env file:

APP_PORT=8080
MYSQL_PORT=33060

Or when starting Vessel:

APP_PORT=8080 MYSQL_PORT=33060 ./vessel start

Then you can view your project at http://localhost:8080 and access your database locally from port 33060;

Sequel Pro

Since we bind the MySQL to port 3306, SequelPro can access the database directly.

sequel pro access

The password for user root is set by environment variable DB_PASSWORD from within the .env file.

The port setting must match the MYSQL_PORT environment variable, which defaults to 3306.

Common Commands

Here's a list of built-in helpers you can use. Any command not defined in the vessel script will default to being passed to the docker-compose command. If not command is used, it will run docker-compose ps to list the running containers for this environment.

Show Vessel Version or Help

# shows vessel current version
$ vessel --version # or [ -v | version ]

# shows vessel help
$ vessel --help # or [ -H | help ]

Starting and Stopping Vessel

# Start the environment
./vessel start

## This is equivalent to
./vessel up -d

# Stop the environment
./vessel stop

## This is equivalent to
./vessel down

Development

# Use composer
./vessel composer <cmd>
./vessel comp <cmd> # "comp" is a shortcut to "composer"

# Use artisan
./vessel artisan <cmd>
./vessel art <cmd> # "art" is a shortcut to "artisan"

# Run tinker REPL
./vessel tinker # "tinker" is a shortcut for "artisan tinker"

# Run phpunit tests
./vessel test

## Example: You can pass anything you would to phpunit to this as well
./vessel test --filter=some.phpunit.filter
./vessel test tests/Unit/SpecificTest.php


# Run npm
./vessel npm <cmd>

## Example: install deps
./vessel npm install

# Run yarn

./vessel yarn <cmd>

## Example: install deps
./vessel yarn install

# Run gulp
./vessel gulp <cmd>

Docker Commands

As mentioned, anything not recognized as a built-in command will be used as an argument for the docker-compose command. Here's a few handy tricks:

# Both will list currently running containers and their status
./vessel
./vessel ps

# Check log output of a container service
./vessel logs # all container logs
./vessel logs app # nginx | php logs
./vessel logs mysql # mysql logs
./vessel logs redis # redis logs

## Tail the logs to see output as it's generated
./vessel logs -f # all logs
./vessel logs -f app # nginx | php logs

## Tail Laravel Logs
./vessel exec app tail -f /var/www/html/storage/logs/laravel.log

# Start a bash shell inside of a container
# This is just like SSH'ing into a server
# Note that changes to a container made this way will **NOT**
#   survive through stopping and starting the vessel environment
#   To install software or change server configuration, you'll need to
#     edit the Dockerfile and run: ./vessel build
./vessel exec app bash

# Example: mysqldump database "homestead" to local file system
#          We must add the password in the command line this way
#          This creates files "homestead.sql" on your local file system, not
#          inside of the container
# @link https://serversforhackers.com/c/mysql-in-dev-docker
./vessel exec mysql mysqldump -u root -psecret homestead > homestead.sql

What's included?

The aim of this project is simplicity. It includes:

  • PHP 7.4
  • MySQL 5.7
  • Redis (latest)
  • NodeJS (latest), with Yarn & Gulp

How does this work?

If you're unfamiliar with Docker, try out this Docker in Development course, which explains important topics in how this is put together.

If you want to see how this workflow was developed, check out Shipping Docker and signup for the free course module which explains building this Docker workflow.

Supported Systems

Vessel requires Docker, and currently only works on Windows, Mac and Linux.

Windows requires running Hyper-V. Using Git Bash (MINGW64) and WSL are supported. Native Windows is still under development.

Mac Linux Windows
Install Docker on Mac Install Docker on Debian Install Docker on Windows
Install Docker on Ubuntu
Install Docker on CentOS

GitHub

https://github.com/shipping-docker/vessel
Comments
  • 1. How to configure xDebug w/ PHPStorm

    Description

    I have been trying to figure out all day how to get xDebug configured with Vessel and am not have any success at all. Does ANYBODY know the trick to making this work?

    OS

    My OS is:

    • [x] MacOS Sierra, High Sierra

    Docker

    The output of docker version:

    Client:
     Version:	17.12.0-ce
     API version:	1.35
     Go version:	go1.9.2
     Git commit:	c97c6d6
     Built:	Wed Dec 27 20:03:51 2017
     OS/Arch:	darwin/amd64
    
    Server:
     Engine:
      Version:	17.12.0-ce
      API version:	1.35 (minimum version 1.12)
      Go version:	go1.9.2
      Git commit:	c97c6d6
      Built:	Wed Dec 27 20:12:29 2017
      OS/Arch:	linux/amd64
      Experimental:	true
    

    The output of docker-compose version:

    docker-compose version 1.18.0, build 8dd22a9
    docker-py version: 2.6.1
    CPython version: 2.7.12
    OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016
    
    Reviewed by mfour-merickson at 2018-01-14 22:18
  • 2. Add windows support

    Hey @fideloper

    The Windows support is here! Everything works beautifully, so please let me know if you have any comments or suggestions. I have updated the readme docs as well.

    Cheers!

    Reviewed by cmosguy at 2017-10-20 22:50
  • 3. laravel.log: Permission denied.

    On first install, after vessel start.

    Visiting http://localhost

    Immediately get Whoops error:

    The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied
    

    OpenSUSE 42.3 Docker version 17.04.0-ce, build 78d1802 ZSH shell

    I know it's newly released. Just a quick observation.

    Edit: Connecting to app container: ./vessel exec app bash

    and then manually running: chown -R www-data: /var/www/html

    Resolves this issue. Not sure it's not running from the dockerfile.

    Reviewed by faasie at 2017-10-08 02:08
  • 4. Unable to use mysql

    Description

    I freshly installed docker and Vessel on my working station. But when trying to migrate my database, I get an error :

    Illuminate\Database\QueryException  : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known (SQL: select * from information_schema.tables where table_schema = laravel and table_name = migrations and table_type = 'BASE TABLE')
    

    And when running

    # Log into mysql
    ./vessel mysql
    

    I get this message : ERROR: No container found for mysql_1

    Thanks for your help !

    OS

    My OS is:

    • [x] MacOS [Mojave]
    • [ ] Linux
    • [ ] Windows

    Docker

    The output of docker version:

    Client: Docker Engine - Community
     Version:           18.09.2
     API version:       1.39
     Go version:        go1.10.8
     Git commit:        6247962
     Built:             Sun Feb 10 04:12:39 2019
     OS/Arch:           darwin/amd64
     Experimental:      false
    
    Server: Docker Engine - Community
     Engine:
      Version:          18.09.2
      API version:      1.39 (minimum version 1.12)
      Go version:       go1.10.6
      Git commit:       6247962
      Built:            Sun Feb 10 04:13:06 2019
      OS/Arch:          linux/amd64
      Experimental:     false
    

    The output of docker-compose version:

    docker-compose version 1.23.2, build 1110ad01
    docker-py version: 3.6.0
    CPython version: 3.6.6
    OpenSSL version: OpenSSL 1.1.0h  27 Mar 2018
    

    The output of docker image ls:

    REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
    vessel/node         latest              3e98f69e6c95        About an hour ago   928MB
    vessel/app          latest              cf10e96ea585        About an hour ago   355MB
    node                latest              b074182f4154        6 hours ago         906MB
    mysql               5.7                 a1aa4f76fab9        15 hours ago        373MB
    redis               alpine              72e76053ebb7        3 weeks ago         50.9MB
    ubuntu              18.04               7698f282e524        3 weeks ago         69.9MB
    
    Reviewed by bistory at 2019-06-11 14:46
  • 5. ./vessel build fails | invalid user ID 'node'

    Hello there,

    I've just tried to install vessel (on Linux) but the ./vessel build node command fails with this message:

    usermod: invalid user ID 'node'
    ERROR: Service 'node' failed to build: The command '/bin/sh -c usermod -u $uid node' returned a non-zero code: 3
    

    The app image builds fine.

    Reviewed by Lednerb at 2017-11-06 00:24
  • 6. Fallback to docker if composer is not present on the local machine

    Hey there @shippingdocker :) first of all, thanks for Vessel. I really like how it makes things simple.

    I noticed a strange thing and I wanted to fix it.

    I tried to reproduce all the steps in order to prepare everything without locally installed PHP & Composer.

    However, if you go through all the steps as explained in the docs, once you arrive to the bash vessel init you get a "No composer command found" because there isn't a fallback to docker while trying to get initialize COMPOSER variable in the bash file.

    Here's a fix proposal: if COMPOSER value cannot be resolved via which, the fallback is a docker run and everything works normally.

    Let me know what do you think about this :)

    Reviewed by francescomalatesta at 2017-10-22 12:16
  • 7. Unable to locate packages php7.2-memcached and php7.2-xdebug

    Description

    When rebuilding images, the apt-get install command from app container fails with a Unable to locate package error.

    image

    OS

    My OS is:

    • [X] MacOS Mojave (10.14)

    Docker

    The output of docker version:

    Client:
     Version:           18.06.1-ce
     API version:       1.38
     Go version:        go1.10.3
     Git commit:        e68fc7a
     Built:             Tue Aug 21 17:21:31 2018
     OS/Arch:           darwin/amd64
     Experimental:      false
    
    Server:
     Engine:
      Version:          18.06.1-ce
      API version:      1.38 (minimum version 1.12)
      Go version:       go1.10.3
      Git commit:       e68fc7a
      Built:            Tue Aug 21 17:29:02 2018
      OS/Arch:          linux/amd64
      Experimental:     true
    

    The output of docker-compose version:

    docker-compose version 1.22.0, build f46880f
    docker-py version: 3.4.1
    CPython version: 3.6.4
    OpenSSL version: OpenSSL 1.0.2o  27 Mar 2018
    
    Reviewed by gabrielboliveira at 2018-10-15 13:47
  • 8. Windows support for Git Bash and WSL

    Windows Support

    There are (potentially) 3 ways Windows developers would access Vessel and/or Docker

    1. MINGW64 - This includes Git Bash, Babun, Cygwin and direct MINGW64 installations
    2. Windows Subsystem for Linux (WSL)
    3. Native Windows - Command Prompt or Powershell

    Since the Vessel script is written in bash the 3rd option is really it's own thing. The first 2 options give us a bash shell (with other common GNU utils like sed) in which we can utilize the bash script.

    Notes on things added

    • I didn't use Windows as a result of a detection because I figured this would be reserved for native windows support and I don't want to confuse people. Instead the MINGW64 is being used.

    • Using $(uname -s) on WSL will just return "Linux". Because of this we need to add a detection method for WSL. Fortunately the output of /proc/version differs as WSL adds Microsoft to their version name. We can grep this output for Microsoft to determine it is WSL instead of a Linux OS.

    Differences between #20 and this PR

    1. CHANGED The detection was listed as Windows10 but that can be confusing for people looking for native windows support.
    2. REMOVED COMPOSE_CONVERT_WINDOWS_PATHS=1 doesn't appear to be necessary. The documentation only states Docker Toolbox (legacy) or docker-machine.
    3. REMOVED COMPOSE="winpty $COMPOSE" While winpty is necessary in some cases but ONLY if you are using Mintty as the default terminal for Git Bash. This choice is made during the installation of Git for Windows. If you are using the standard command prompt this is not needed at all. I haven't ran into any issues from the Vessel executing script using Mintty. The only time I have had to use this is when I'm trying to log onto one of the containers interactively. In this case it prompts me to try prefixing winpty in which I just do that and everything works.
    4. ADDED SEDCMD="sed -i" under the MING64 detection. It was missing from that PR and so the substitutions under Setting .env variables were not working correctly.

    This script was tested on 2 different Windows machines; 1 domain joined laptop, and 1 custom desktop PC. Both are running Windows 10 Pro, Version 1709 Build 162999.19 (Creators Update)

    Docker for Windows (Docker Community Edition) Version 17.09.0-ce-win33 (13620)

    This PR would close #20

    Reviewed by cringer at 2017-10-26 22:11
  • 9. Suggestion: Use xdebug.remote_connect_back setting

    First of all, thanks for this project!

    I would like to share a suggestion. How about using xdebug.remote_connect_back instead of xdebug.remote_host?

    This change would avoid setting the xdebug port. I think it's a good choice for development environments.

    If you agree, I can work at the PR.

    Reviewed by aanton at 2017-10-23 14:05
  • 10. Install php-redis by default

    Description

    Since predis/predis seems to be unmaintained it might make sense to install php-redis and no longer rely on predis/predis.

    OS

    My OS is:

    • [ ] MacOS [Choose one: Yosemite, El Capitan, Sierra, High Sierra, Mojave]
    • [x] Linux
    • [ ] Windows

    Docker

    The output of docker version:

    Docker version 19.03.1, build 74b1e89
    

    The output of docker-compose version:

    docker-compose version 1.17.0, build ac53b73
    docker-py version: 2.5.1
    CPython version: 2.7.13
    OpenSSL version: OpenSSL 1.0.1t  3 May 2016
    
    Reviewed by lorenzbausch at 2019-09-03 16:01
  • 11. Proposal: Add `help` output

    Hey @fideloper

    I am curious if you are keen on accepting a PR to add help output

    > vessel --help, -H
    

    I often forget what commands are available when I am using across projects, thinking it would be nice to have internal help system

    Reviewed by mikeerickson at 2019-03-16 17:55
  • 12. Append PHP version on Redis php extension

    Hi,

    I've worked on a project that used, this docker environement, but I found an issue when I build.

    The version of the php-redis extension is missing so it install php8.1 instead of php7.3

    Reviewed by yepzy at 2022-05-24 12:08
  • 13. Clockwork debugger blank because of expires.conf

    Description

    I've installed the Clockwork debugger: https://underground.works/clockwork/#docs-installation When accessing the local Clockwork app under http://localhost/__clockwork/app it gives a blank screen, and debug tools in browser show that all Clockwork images,js and css files return a 404.

    Tracked the problem down to docker/app/h5bp/location/expires.conf, specifically the expires rule for images, json and js/css files.

    When removed, and then vessel down followed by vessel build app Clockwork starts working.

    My knowledge of nginx config is a bit rusty, so I'm unsure what could be done to fix this. Hoping we can integrate a fix so that I don't have to manually do this every time I install or update Clockwork? 👯‍♂️

    OS

    macOS Catalina 10.15.4

    My OS is:

    • [*] MacOS [Choose one: Yosemite, El Capitan, Sierra, High Sierra, Mojave]
    • [ ] Linux
    • [ ] Windows

    Docker

    The output of docker version:

    > docker version
    Client: Docker Engine - Community
     Version:           19.03.8
     API version:       1.40
     Go version:        go1.12.17
     Git commit:        afacb8b
     Built:             Wed Mar 11 01:21:11 2020
     OS/Arch:           darwin/amd64
     Experimental:      false
    
    Server: Docker Engine - Community
     Engine:
      Version:          19.03.8
      API version:      1.40 (minimum version 1.12)
      Go version:       go1.12.17
      Git commit:       afacb8b
      Built:            Wed Mar 11 01:29:16 2020
      OS/Arch:          linux/amd64
      Experimental:     false
     containerd:
      Version:          v1.2.13
      GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
     runc:
      Version:          1.0.0-rc10
      GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
     docker-init:
      Version:          0.18.0
      GitCommit:        fec3683
    

    The output of docker-compose version:

    > docker-compose version
    docker-compose version 1.25.5, build 8a1c60f6
    docker-py version: 4.1.0
    CPython version: 3.7.5
    OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020
    
    Reviewed by madsem at 2020-05-21 09:48
  • 14. Support for Websocket Laravel Library

    This new PR supports laravel websockets running on same container to have a good integration with websockets Library, it runs on PORT 6001 and works only installing its library.

    Reviewed by Benjacho at 2019-10-10 16:10
Quickly deploy a seedbox with self-hosted services and a web portal using Docker and docker-compose.
Quickly deploy a seedbox with self-hosted services and a web portal using Docker and docker-compose.

Seedbox Quickly deploy and configure a seedbox with self-hosted services and a web portal using Docker and a single docker-compose.yml file. Screensho

Jun 6, 2022
Vagrant is a tool for building and distributing development environments.

Vagrant Website: https://www.vagrantup.com/ Source: https://github.com/hashicorp/vagrant HashiCorp Discuss: https://discuss.hashicorp.com/c/vagrant/24

Jun 30, 2022
Docker Shortie, simplifying calls to CLI commands inside docker containers.

What is DockTie Is a simple wrapper script for commands inside docker container(s). So for instance, what you would normally run as: docker-compo

Mar 31, 2022
Phansible - generate Vagrant + Ansible dev environments for PHP

Phansible Phansible is a simple generator for Vagrant projects, targeting PHP development environments, using Ansible as Provisioner. It was inspired

Jun 29, 2022
A modern Docker LAMP stack and MEAN stack for local development
A modern Docker LAMP stack and MEAN stack for local development

The Devilbox Usage | Architecture | Community | Features | Intranet | Screenshots | Contributing | Logos | License Support for valid https out of the

Jun 26, 2022
Laravel 5 with Dockerized Gulp, PHP-FPM, MySQL and nginx using docker-compose

docker-laravel Laravel 5 with Dockerized PHP-FPM, MySQL and nginx using docker-compose Usage Get Composer docker-compose run --rm phpnginx curl -O htt

Feb 8, 2022
Docker with PHP 7.4 fpm, Nginx, Composer, PhpUnit and MaridaDB

Clean Docker with PHP Docker with PHP 7.4 fpm, Nginx, Composer, PhpUnit and MariaDB Starting app docker-compose up -d Main page

Apr 26, 2022
A package that allows you to generate simple and fast Docker configurations for your Laravel application!

A package that allows you to generate simple and fast Docker configurations for your Laravel application!

Dec 23, 2021
ServD - a Docker PHP development environment heavily inspired by Laravel Valet and Laradock

ServD ServD is a Docker PHP development environment heavily inspired by Laravel Valet and Laradock, it supports multiple projects within a working dir

May 13, 2022
Full PHP development environment for Docker.
Full PHP development environment for Docker.

Full PHP development environment based on Docker. Use Docker First - Learn About It Later! Join Us Awesome People Laradock is an MIT-licensed open sou

Jun 24, 2022
Symfony5 template w/ Docker config

Symfony5 w/ Docker config A project template in the following configuration: Symfony 5.2 PHP8 PostgreSQL 13.2 Separate Docker containers for Nginx, FP

May 14, 2022
Docker NAT容器自助部署php版本,实现从搭建到跑路的全生命周期功能。
Docker NAT容器自助部署php版本,实现从搭建到跑路的全生命周期功能。

DockerLabs-V1 游客可通过web页面直接创建出NAT容器,本项目从发布后将不再维护任何bug,以后有时间会出sdk重构版。 环境要求 使用了赛邮云发送短信号码,需要自己去申请appid和appkey填写到app_config.php文件中。需要修改所有html文件和api/kill.ph

Mar 4, 2022
The project provides a docker image for Files App(files.photo.gallery).
The project provides a docker image for Files App(files.photo.gallery).

For the purpose of learning,I replace the files.js with cracked version which just remove authorization code.

Apr 13, 2022
Multipurpose VIP Docker container images

VIP Container Images This repository is used to build Docker container images used, among others, by the VIP Local Development Environment. Images are

Mar 7, 2022
Docker Containers for simple Laravel development.
Docker Containers for simple Laravel development.

Docker containers of Laravel development. Docker Containers for simple Laravel development. Prerequisites This package only works for Linux users righ

May 19, 2022
Shopware 6 app boilerplate + Symfony backend + Dockware docker dev environment 💙

Shopware 6 app boilerplate with Symfony backend This boilerplate template can be used to get up and running with a docker-based dev setup for Shopware

Nov 14, 2021
Ponto de partida para utilização do Docker Compose 💙✨
Ponto de partida para utilização do Docker Compose 💙✨

Docker-compose Docker | WSL2 | PHP | Nginx | MySQL Esse projeto fornece um ponto de partida para integrar diferentes serviços usando um arquivo Compos

Nov 9, 2021
Docker-based workflow management system for Laravel

DevOption Workflows Workflows is a Docker-based workflow management system for Laravel applications. Installation You can install the package via comp

Jan 5, 2022
Runs a PHP-based startpage in Docker
Runs a PHP-based startpage in Docker

docker-php-startpage Runs a PHP-based startpage in Docker Source code: GitHub Docker container: Docker Hub Image base: PHP Init system: N/A Applicatio

Jun 4, 2022