I have a laravel app.
I used laravel sail to generate the docker-compose.yml file.
Sail also created a Dockerfile in ./vendor/laravel/sail/runtimes/8.0
I see this also in the .yml file.
When I run on my local maschine docker-compose up
it will create an image and run a container.
This container works fine.
Now I use docker-compose build
to create an image which I want to share with a colleague.
Docker will create the image successfully. I push it to HUB via Docker Desktop and my colleague can pull it.
But the pulled image does not work. When I observe the container through the CLI the app code is not even there. It looks like an empty image. Same also happens when I pull it on my local maschine.
Something gets messed up when I push the image to docker. Does anyone have an idea whats happening?
As per request here are the steps to reproduce:
Add laravel sail to an existing laravel project (You do not need the execute this if you create a new laravel project, which is laravel 8+):
composer require laravel/sail --dev
Then follow the laravel sail guide and call:
php artisan sail:install
The above call will generate a docker-compose.yml
Now you can run a container with docker-compose up
.
This will create an image and run a container. If you want to push this image to the HUB, then the issues appear.
Here is my docker-compose.yml
version: '3'
services:
laravel.app:
build:
context: ./vendor/laravel/sail/runtimes/8.0
dockerfile: Dockerfile
args:
WWWGROUP: '${WWWGROUP}'
image: dockeruser/feedback_app:1.5
extra_hosts:
- 'host.docker.internal:host-gateway'
ports:
- '${APP_PORT:-80}:80'
environment:
WWWUSER: '${WWWUSER}'
LARAVEL_SAIL: 1
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
volumes:
- '.:/var/www/html'
networks:
- sail
networks:
sail:
driver: bridge