K
K
Konstantin Zhikhor2020-05-27 21:32:34
Docker
Konstantin Zhikhor, 2020-05-27 21:32:34

Why won't Docker start?

I'm trying to deploy a working environment on docker for the first time. Help me please.

When commanded in the console, docker-compose up displays the following result with errors
docker-compose up
Building php
[WARNING]: Empty continuation line found in:
RUN apt-get update && apt-get install -y curl wget git libfreetype6-dev libjpeg62-turbo-dev libxslt-dev libicu-dev libmcrypt-dev libpng12-dev libxml2-dev && docker-php-ext-install -j$(nproc) iconv mcrypt mbstring pdo_pgsql zip && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd
[WARNING]: Empty continuation lines will become errors in a future release.
Step 1/10 : FROM php:7.0-fpm
7.0-fpm: Pulling from library/php
177e7ef0df69: Pull complete
9bf89f2eda24: Pull complete
350207dcf1b7: Pull complete
a8a33d96b4e7: Pull complete
8069cdba34b5: Pull complete
25ae788babab: Pull complete
1df95586682b: Pull complete
4c66f054f322: Pull complete
b7221dc910cf: Pull complete
71b3dbdbc6f4: Pull complete
Digest: sha256:8e8644c0fd61424939fff072ca617469550bbb659158301a2dcadf334746a1c2
Status: Downloaded newer image for php:7.0-fpm
---> 29e9a8718c7b
Step 2/10 : RUN apt-get update && apt-get install -y curl wget git libfreetype6-dev libjpeg62-turbo-dev libxslt-dev libicu-dev libmcrypt-dev libpng12-dev libxml2-dev && docker-php-ext-install -j$(nproc) iconv mcrypt mbstring pdo_pgsql zip && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd
---> Running in f2350231ef18
Get:1 security.debian.org/debian-security stretch/updates InRelease [94.3 kB]
Ign:2 deb.debian.org/debian stretch InRelease
Get:3 deb.debian.org/debian stretch-updates InRelease [91.0 kB]
Get:4 security.debian.org/debian-security stretch/updates/main amd64 Packages [527 kB]
Get:5 deb.debian.org/debian stretch Release [118 kB]
Get:6 deb.debian.org/debian stretch Release.gpg [2410 B]
Get:7 deb.debian.org/debian stretch-updates/main amd64 Packages [27.9 kB]
Get:8 deb.debian.org/debian stretch/main amd64 Packages [7083 kB]
Fetched 7944 kB in 4s (1960 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Package libpng12-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'libpng12-dev' has no installation candidate
ERROR: Service 'php' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y curl wget git libfreetype6-dev libjpeg62-turbo-dev libxslt-dev libicu-dev libmcrypt-dev libpng12-dev libxml2-dev && docker-php-ext-install -j$(nproc) iconv mcrypt mbstring pdo_pgsql zip && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ && docker-php-ext-install -j$(nproc) gd' returned a non-zero code: 100


docker-compose
version: '2.2'

services:

db:
image: postgres
restart: always
environment:
POSTGRES_DB: startup_db
POSTGRES_USER: startuper
POSTGRES_PASSWORD: test123
web:
image: nginx
volumes:
- ./startup.conf:/etc/nginx/conf.d/startup.loc
ports:
- "8080:80"
environment:
- NGINX_HOST=startup.loc
- NGINX_PORT=80
command: /bin/bash -c "envsubst < /etc/nginx/conf.d/mysite.template > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"
php:
# Билдим с помощью dockerfile указав директорию где он лежит
build: ./PHP

container_name: php-fpm

volumes:
- ./web/startup.loc:/var/www/startup.loc

links:
- db


Dockerfile
FROM php:7.0-fpm

RUN apt-get update && apt-get install -y \
curl \
wget \
git \
libfreetype6-dev \
libjpeg62-turbo-dev \
libxslt-dev \
libicu-dev \
libmcrypt-dev \
libpng12-dev \
libxml2-dev \

&& docker-php-ext-install -j$(nproc) iconv mcrypt mbstring pdo_pgsql zip \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd

RUN docker-php-ext-configure intl
RUN docker-php-ext-install intl
RUN docker-php-ext-install xsl
RUN docker-php-ext-install soap

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

ADD php.ini /usr/local/etc/php/conf.d/40-custom.ini

WORKDIR /var/www/startup.loc

CMD ["php-fpm"]


startup.conf
server {
index index.php;
server_name startuo.loc;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/startuo.loc/public;

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AZ, 2021-01-27
@Stam_emg

E: Package 'libpng12-dev' has no installation candidate
hence ERROR: Service 'php' failed to build: because not installed. in debian stretch the package is called libpng-dev .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question