简体   繁体   English

docker 图像中的问题它没有启动

[英]Problem in docker images it is not starting

I made in my project nginx, mysql, phpMyadmin, encore and php images.我在我的项目中制作了 nginx、mysql、phpMyadmin、encore 和 php 图像。 Just php and encore dosent work, they are successed built, but the are with red color.只是php和encore dosent work,它们已经成功构建,但是是红色的。

The directory of the project:项目目录:

在此处输入图像描述

that is my docker-compose.yml:那是我的 docker-compose.yml:

version: '3.3'
services:
 database:
   container_name: database
   image: mysql:8.0
   restart: always
   command: --default-authentication-plugin=mysql_native_password
   environment:
     MYSQL_ROOT_PASSWORD: alsbls
     MYSQL_DATABASE: infoSystem
     MYSQL_USER: alsbls
     MYSQL_PASSWORD: alsbls
   ports:
     - '4306:3306'
   volumes:
     - ./mysql:/var/lib/mysql

 php:
   container_name: php
   restart: always
   build:
     context: ./php
   ports:
     - '9000:9000'
   volumes:
     - ./app:/var/www/infoSystem

   depends_on:
     - database

 nginx:
   container_name: nginx
   image: nginx:stable-alpine
   restart: always
   ports:
     - '8080:80'
   volumes:
     - ./app:/var/www/infoSystem
     - ./nginx/default.conf:/etc/nginx/conf.d/default.conf
   depends_on:
     - php
     - database

 phpmyadmin:
   image: phpmyadmin/phpmyadmin:latest
   restart: always
   environment:
     PMA_HOST: database
     PMA_USER: alsbls_root
     PMA_PASSWORD: alsbls_root
   ports:
     - "8081:81"

 encore:
   container_name: encore
   restart: always
   build:
     context: ./php
   volumes:
       - ./:/var/www/html

That is my Dockerfile:那是我的 Dockerfile:

FROM php:8.0-fpm
          
RUN apt update   \
            && apt install -y zlib1g-dev g++ git libicu-dev zip libzip-dev zip \
            && docker-php-ext-install intl opcache pdo pdo_mysql \
            && pecl install apcu \
            && docker-php-ext-enable apcu \
            && docker-php-ext-configure zip \
            && docker-php-ext-install zip
WORKDIR /var/www/infoSystem
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN curl -sS https://get.symfony.com/cli/installer | bash
RUN mv /root/.symfony/bin/symfony /usr/local/bin/symfony
RUN git config --global user.email "devojob97@gmail.com" \
        && git config --global user.name  "alsbls"




FROM node:12.10.0
WORKDIR /var/www/html
COPY entrypoint.sh /usr/local/bin/entrypoint
RUN ["chmod", "+x", "/usr/local/bin/entrypoint"]
ENTRYPOINT ["/usr/local/bin/entrypoint"]
USER node

that is the entrypoint.sh in the same dir of Dockerfile:这是 Dockerfile 相同目录中的 entrypoint.sh:

#!/bin/bash
# Prevent container from shutting down
while true; do sleep 3600; done

I didn't receive any error message on the terminal.我没有在终端上收到任何错误消息。 Maybe some one now the issues.也许有人现在的问题。

Best regards最好的祝福

I saw in the docker log of the encore image the following error:在encore镜像的docker日志中看到如下错误:

standard_init_linux.go:190: exec user process caused "no such file or directory" - Docker

And then I tried to use the following command outside of the container:然后我尝试在容器外使用以下命令:

dos2unix your-file.sh

This tutorial helped me to solve it: 本教程帮助我解决了这个问题:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM