After success build container on docker, try running with docker-compose up -d, until here is okay. But try to run artisan CLI, I have an error with message Service "php" is not running container #1. This project using lumen framework. Before I'm using Windows for OS
this is my docker-compose.yml
version: "3"
services:
app:
build:
context: .
dockerfile: Dockerfile
image: appbilling-service
container_name: appbilling-api
volumes:
- app-data:/var/www/html
- ./docker/php/php.ini:/usr/local/etc/php/php.ini
links:
- db
server:
image: nginx:1.23-alpine
container_name: appbilling-server
ports:
- 8100:80
volumes:
- app-data:/var/www/html
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
links:
- app
db:
image: mysql:8
container_name: mydb
command: --default-authentication-plugin=mysql_native_password
ports:
- 33061:3306
environment:
MYSQL_DATABASE: appbilling_test
MYSQL_USER: user
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: root
volumes:
- db-data:/var/lib/mysql
- ./docker/mysql/my.cnf:/etc/mysql/my.cnf
- ./docker/mysql/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
volumes:
db-data:
app-data:
and this is my dockerfile
FROM composer:2 as vendor
COPY ./database ./database
COPY ./tests ./tests
COPY composer.json composer.json
COPY composer.lock composer.lock
RUN composer install \
--ignore-platform-reqs \
--no-interaction \
--no-plugins \
--no-scripts \
--prefer-dist
FROM php:7.4-fpm-alpine
COPY . /var/www/html
WORKDIR /var/www/html
COPY . .
COPY --from=vendor /app/vendor ./vendor/
COPY ./docker/php/php.ini /usr/local/etc/php/php.ini
RUN apk add --no-cache \
oniguruma-dev \
mysql-client \
libxml2-dev \
# If you have enabled gd plugin
# libpng-dev \
# libjpeg-turbo-dev \
# freetype-dev \
git \
zip \
unzip \
curl
RUN docker-php-ext-install \
bcmath \
mbstring \
pdo \
pdo_mysql \
tokenizer \
xml
# If you need to work with image manipulation.
# RUN docker-php-ext-configure gd --with-freetype --with-jpeg
# RUN docker-php-ext-install gd
RUN adduser www-data www-data
RUN chown -R www-data:www-data .
USER www-data
EXPOSE 9000
CMD ["php-fpm"]
I'm try to run lumen sevrice with port 8100 is run normally