Docker build退出并带有代码1:我在做什么错?

时间:2018-10-23 14:03:26

标签: docker

我是运行Docker的初学者,我在Debian:Jessie上为我的一个小项目构建了一个虚拟机,以运行PHP5.6,MySql 5.5。

该容器可以很好地构建所有依赖项,但它不想正常启动。我要么收到“退出代码1”错误,要么收到“退出代码0”并关闭容器。

这是我的文件,我可能丢失了一些东西,但是我花了几天时间,却找不到它。

这是我的Dockerfile:

#Download base image Debien 8 (Jessie)
FROM debian:jessie

ADD . /var/www/

RUN apt-get update

# Adding PHP 7.1 repository
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apt-utils
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y wget apt-transport-https lsb-release ca-certificates
RUN DEBIAN_FRONTEND=noninteractive wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
RUN DEBIAN_FRONTEND=noninteractive echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list

RUN apt-get update

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y apache2 libapache2-mod-php7.1
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y mysql-server mysql-client
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y git git-core
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl zip unzip gzip

# Composer
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
RUN php -r "if (hash_file('SHA384', 'composer-setup.php') === '93b54496392c062774670ac18b134c3b3a95e5a5e5c8f1a9f115f203b75bf9a129d5daa8ba6a13e2cc8a1da0806388$
RUN php composer-setup.php
RUN php -r "unlink('composer-setup.php');"

# Configure Apache
RUN rm -rf /var/www/* \
    && a2enmod rewrite \
    && echo "ServerName localhost" >> /etc/apache2/apache2.conf
ADD vhost.conf /etc/apache2/sites-available/000-default.conf
#RUN service apache2 restart
RUN rm -f /run/apache2/apache2.pid
CMD apachectl -DFOREGROUND -e info

# Add main start script for when image launches
ADD run.sh /run.sh
RUN chmod 775 /run.sh

EXPOSE 80
EXPOSE 443

CMD ["sh", "./run.sh"]

这是run.sh:

#!/bin/bash
chmod -R 775 /var/www
chown -R 1000:www-data /var/www
source /etc/apache2/envvars
exec apache2 -D FOREGROUND

这是我的docker-compose.yml:

version: "2"
services:
    web:
        build: .
        ports:
            - "8081:80"
        volumes:
            - .:/var/www

这是我得到的输出:

lain@navidebi:~/Sites/ceizyl.fr$ docker-compose --verbose up
compose.config.config.find: Using configuration files: ./docker-compose.yml
docker.utils.config.find_config_file: Trying paths: ['/home/lain/.docker/config.json', '/home/lain/.dockercfg']
docker.utils.config.find_config_file: Found file at path: /home/lain/.docker/config.json
docker.auth.load_config: Found 'auths' section
docker.auth.parse_auth: Found entry (registry='https://index.docker.io/v1/', username='jinxy')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/version HTTP/1.1" 200 535
compose.cli.command.get_client: docker-compose version 1.22.0, build f46880fe
docker-py version: 3.4.1
CPython version: 3.6.6
OpenSSL version: OpenSSL 1.1.0f  25 May 2017
compose.cli.command.get_client: Docker base_url: http+docker://localhost
compose.cli.command.get_client: Docker version: Platform={'Name': ''}, Components=[{'Name': 'Engine', 'Version': '18.06.1-ce', 'Details': {'ApiVersion': '1.38', 'Arch': 'amd64', 'BuildTime': '2018-08-21T17:22:21.000000000+00:00', 'Experimental': 'false', 'GitCommit': 'e68fc7a', 'GoVersion': 'go1.10.3', 'KernelVersion': '4.9.0-8-amd64', 'MinAPIVersion': '1.12', 'Os': 'linux'}}], Version=18.06.1-ce, ApiVersion=1.38, MinAPIVersion=1.12, GitCommit=e68fc7a, GoVersion=go1.10.3, Os=linux, Arch=amd64, KernelVersion=4.9.0-8-amd64, BuildTime=2018-08-21T17:22:21.000000000+00:00
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('ceizylfr_default')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/networks/ceizylfr_default HTTP/1.1" 200 445
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': False,
 'ConfigFrom': {'Network': ''},
 'ConfigOnly': False,
 'Containers': {},
 'Created': '2018-10-09T22:11:40.811373843+02:00',
 'Driver': 'bridge',
 'EnableIPv6': False,
 'IPAM': {'Config': [{'Gateway': '172.18.0.1', 'Subnet': '172.18.0.0/16'}],
          'Driver': 'default',
          'Options': None},
...
compose.cli.verbose_proxy.proxy_callable: docker info <- ()
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/info HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker info -> {'Architecture': 'x86_64',
 'BridgeNfIp6tables': True,
 'BridgeNfIptables': True,
 'CPUSet': True,
 'CPUShares': True,
 'CgroupDriver': 'cgroupfs',
 'ClusterAdvertise': '',
 'ClusterStore': '',
 'ContainerdCommit': {'Expected': '468a545b9edcd5932818eb9de8e72413e616e86e',
                      'ID': '468a545b9edcd5932818eb9de8e72413e616e86e'},
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_network <- ('ceizylfr_default')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/networks/ceizylfr_default HTTP/1.1" 200 445
compose.cli.verbose_proxy.proxy_callable: docker inspect_network -> {'Attachable': False,
 'ConfigFrom': {'Network': ''},
 'ConfigOnly': False,
 'Containers': {},
 'Created': '2018-10-09T22:11:40.811373843+02:00',
 'Driver': 'bridge',
 'EnableIPv6': False,
 'IPAM': {'Config': [{'Gateway': '172.18.0.1', 'Subnet': '172.18.0.0/16'}],
          'Driver': 'default',
          'Options': None},
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=ceizylfr', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dceizylfr%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=False, filters={'label': ['com.docker.compose.project=ceizylfr', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/json?limit=-1&all=0&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dceizylfr%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 3
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 0 items)
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=ceizylfr', 'com.docker.compose.service=web', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dceizylfr%22%2C+%22com.docker.compose.service%3Dweb%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 1139
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': [],
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['/run.sh'],
            'Domainname': '',
            'Entrypoint': None,
            'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'],
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('ceizylfr_web')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/images/ceizylfr_web/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {'Architecture': 'amd64',
 'Author': '',
 'Comment': '',
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['/run.sh'],
            'Domainname': '',
            'Entrypoint': None,
...
compose.cli.verbose_proxy.proxy_callable: docker containers <- (all=True, filters={'label': ['com.docker.compose.project=ceizylfr', 'com.docker.compose.service=web', 'com.docker.compose.oneoff=False']})
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/json?limit=-1&all=1&size=0&trunc_cmd=0&filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dceizylfr%22%2C+%22com.docker.compose.service%3Dweb%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 1139
compose.cli.verbose_proxy.proxy_callable: docker containers -> (list with 1 items)
compose.cli.verbose_proxy.proxy_callable: docker inspect_image <- ('ceizylfr_web')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/images/ceizylfr_web/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_image -> {'Architecture': 'amd64',
 'Author': '',
 'Comment': '',
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['/run.sh'],
            'Domainname': '',
            'Entrypoint': None,
...
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8')
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': [],
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['/run.sh'],
            'Domainname': '',
            'Entrypoint': None,
            'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'],
...
compose.parallel.feed_queue: Pending: {<Service: web>}
compose.parallel.feed_queue: Starting producer thread for <Service: web>
Starting ceizylfr_web_1 ... 
compose.parallel.feed_queue: Pending: {<Container: ceizylfr_web_1 (42b6dc)>}
compose.parallel.feed_queue: Starting producer thread for <Container: ceizylfr_web_1 (42b6dc)>
compose.cli.verbose_proxy.proxy_callable: docker attach <- ('42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8', stdout=True, stderr=True, stream=True)
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.22/containers/42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8/attach?logs=0&stdout=1&stderr=1&stream=1 HTTP/1.1" 101 0
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8/json HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker attach -> <docker.types.daemon.CancellableStream object at 0x7f651c028ac8>
compose.cli.verbose_proxy.proxy_callable: docker start <- ('42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8')
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
compose.parallel.feed_queue: Pending: set()
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.22/containers/42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8/start HTTP/1.1" 204 0
compose.cli.verbose_proxy.proxy_callable: docker start -> None
Starting ceizylfr_web_1 ... done
compose.parallel.feed_queue: Pending: set()
compose.parallel.parallel_execute_iter: Finished processing: <Service: web>
compose.parallel.feed_queue: Pending: set()
Attaching to ceizylfr_web_1
compose.cli.verbose_proxy.proxy_callable: docker events <- (filters={'label': ['com.docker.compose.project=ceizylfr', 'com.docker.compose.oneoff=False']}, decode=True)
web_1  | standard_init_linux.go:190: exec user process caused "exec format error"
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/events?filters=%7B%22label%22%3A+%5B%22com.docker.compose.project%3Dceizylfr%22%2C+%22com.docker.compose.oneoff%3DFalse%22%5D%7D HTTP/1.1" 200 None
compose.cli.verbose_proxy.proxy_callable: docker events -> <docker.types.daemon.CancellableStream object at 0x7f651c061ac8>
compose.cli.verbose_proxy.proxy_callable: docker wait <- ('42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8')
compose.cli.verbose_proxy.proxy_callable: docker inspect_container <- ('42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8')
urllib3.connectionpool._make_request: http://localhost:None "POST /v1.22/containers/42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8/wait HTTP/1.1" 200 30
compose.cli.verbose_proxy.proxy_callable: docker wait -> {'Error': None, 'StatusCode': 1}
urllib3.connectionpool._make_request: http://localhost:None "GET /v1.22/containers/42b6dc90b0aed25c35d4f7fe42ebce5fc70a634e6bcf26141e7532eac46390e8/json HTTP/1.1" 200 None
ceizylfr_web_1 exited with code 1
compose.cli.verbose_proxy.proxy_callable: docker inspect_container -> {'AppArmorProfile': '',
 'Args': [],
 'Config': {'ArgsEscaped': True,
            'AttachStderr': False,
            'AttachStdin': False,
            'AttachStdout': False,
            'Cmd': ['/run.sh'],
            'Domainname': '',
            'Entrypoint': None,
            'Env': ['PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'],
...

请帮助我,我感到绝望。

0 个答案:

没有答案