Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bergh's avatar
Level 1

Move development enviroment from sail to pure docker

Hi.

Due to several projects on different versions I want to have sail free docker developent enviroments.

I have seen some guides, but most of them are for new projects and many does not even work when you try to run composer or migrate.

Many guides also starts with "run 'composer ...'" which makes that guide moot as the point is to be able to run this without any requirements of php on my local system. I want that to be totally clean.

What I have now is one laravel 11, redis, mysql and using npm for vuetify.

Do anyone of you have a guide for migrating from sail to clean docker?

thnaks

0 likes
6 replies
vincent15000's avatar

I just did that last week for a project, using sail for the dev environment and pure docker for the production environment.

I have done it with 3 docker compose files :

  • docker-compose.yml : is the base docker compose file for the common configurations for dev and prod

  • docker-compose.override.yml : is the docker compose file for the specific dev configurations

  • docker-compose.prod.yml : is the docker compose file for the specitif prod configurations

When you run : sail up, it will automatically merge docker-compose.yml and docker-compose.override.yml.

In docker-compose.override.yml, you can add new configurations and/or replace any existing configuration from the docker-compose.yml base file. For example rename a container.

To run the project in production, you need to run this command.

docker-compose -f docker-compose.yml -f docker-compose.prod.yml up

It will merge both docker-compose.yml and docker-compose.override.yml files.

You can even check the resulting configuration file by running this command.

docker-compose -f docker-compose.yml -f docker-compose.prod.yml config

In docker-compose.prod.yml, you can add new configurations and/or replace any existing configuration from the docker-compose.yml base file. For example rename a container.

The advantage is to use exactly the same environment in development and in production.

bergh's avatar
Level 1

@vincent15000 But what Dockerfile does this use?

Remember one of the things I want is not having to rund composer on my local machine.

I am talking about for development, not production

1 like
vincent15000's avatar

@bergh With my suggestion, you can develop only with pure docker and you don't need to install composer in your local machine.

puklipo's avatar

https://laravel.com/docs/11.x/sail#installing-composer-dependencies-for-existing-projects

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -w /var/www/html \
    laravelsail/php83-composer:latest \
    composer install --ignore-platform-reqs

Let's install php and composer locally as well. It's not realistic to "run everything in Docker without installing anything locally." That was a fantasy from 10 years ago.

With Rails, which has native gems, it made sense to run it only on Docker, but with composer it doesn't make sense.

1 like
vincent15000's avatar

@puklipo You don't answer to the question : the OP asks for not using sail and not for installing sail for a team.

Why do you say that with composer it doesn't make sense ? gem is the ruby package manager, exactly as composer is the php package manager.

vincent15000's avatar

You can ever not use sail at all and just use docker.

In this case you just need one unique docker compose file with all the needed containers and run docker-compose up to run the application.

But I suggest you to use sail in dev mode, effectively you can run sail npm run dev and all modifications in your frontend code will automatically be refreshed on the screen without having to build the manifest each time.

Please or to participate in this conversation.