Laravel по-русски

Русское сообщество разработки на PHP-фреймворке Laravel.

Ты не вошёл. Вход тут.

#1 25.06.2018 19:01:24

Ошибка запуска приложение через docker

Привет,
Надо запустить приложение через docker

Установил docker, docker-composer:

$ docker --version
Docker version 17.12.1-ce, build 7390fc6 

При запуске в каталоге приложениея получаю:

$ sudo docker-compose up -d
[sudo] password for serge: 
Starting ukfxpages ... error

ERROR: for ukfxpages  Cannot start service landing_pages_er: driver failed programming external connectivity on endpoint ukfxpages (3317cadd42cb0d46291280e9b848c1f9dc3dd22b0dce5bbb458e68b0c8f61cb7): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

ERROR: for landing_pages_er  Cannot start service landing_pages_er: driver failed programming external connectivity on endpoint ukfxpages (3317cadd42cb0d46291280e9b848c1f9dc3dd22b0dce5bbb458e68b0c8f61cb7): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use
ERROR: Encountered errors while bringing up the project.

Как это побороть  и как запустить приложение?

Спасибо !

Не в сети

#2 26.06.2018 10:25:17

Re: Ошибка запуска приложение через docker

пытаюсь установить docker как писано тут http://larapost.blogspot.com/2016/08/la … ocker.html

$ docker --version
Docker version 17.12.1-ce, build 7390fc6
$ docker-compose --version 
docker-compose version 1.21.2, build a133471

Если я правилно понял то сначала нужно запустить домен командой

$  docker ps 
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.35/containers/json: dial unix /var/run/docker.sock: connect: permission denied
$ sudo -s
[sudo] password for serge: 
root@serge:#  docker ps 
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

Причем

docker ps 

нужно запускать под рутом  ?


Запускаю далее в другой консоле(не под рутом) и получаю ошибку

$ docker-compose up -d                                                                                                                          
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?                                                                                                                                                                                                                                                                                                                                                                                                      
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.   

Погуглив я нашел статью https://github.com/docker/compose/issues/1214 выполняю под рутом:

usermod -aG docker ${USER}
groups $USER
sudo chown -R $USER .

выполнил:

service docker restart

Та же ошибка

$ sudo systemctl status docker.service -l 
[sudo] password for serge:                                                                                                                                                                                                                   
● docker.service - Docker Application Container Engine                                                                                                                                                                                       
   Loaded: loaded (/lib/systemd/system/docker.service; disabled; vendor preset: enabled)                                                                                                                                                     
   Active: active (running) since Tue 2018-06-26 09:59:19 EEST; 4min 48s ago                                                                                                                                                                 
     Docs: [url]https://docs.docker.com[/url]                                                                                                                                                                                                           
 Main PID: 7413 (dockerd)                                                                                                                                                                                                                    
    Tasks: 34                                                                                                                                                                                                                                
   CGroup: /system.slice/docker.service                                                                                                                                                                                                      
           ├─7413 /usr/bin/dockerd -H fd://                                                                                                                                                                                                  
           └─7437 docker-containerd --config /var/run/docker/containerd/containerd.toml                                                                                                                                                      
                                                                                                                                                                                                                                             
чер 26 09:59:18 serge dockerd[7413]: time="2018-06-26T09:59:18.889976331+03:00" level=warning msg="Your kernel does not support swap memory limit"                                                                                           
чер 26 09:59:18 serge dockerd[7413]: time="2018-06-26T09:59:18.890032001+03:00" level=warning msg="Your kernel does not support cgroup rt period"                                                                                            
чер 26 09:59:18 serge dockerd[7413]: time="2018-06-26T09:59:18.890042925+03:00" level=warning msg="Your kernel does not support cgroup rt runtime"                                                                                           
чер 26 09:59:18 serge dockerd[7413]: time="2018-06-26T09:59:18.890698976+03:00" level=info msg="Loading containers: start."                                                                                                                  
чер 26 09:59:19 serge dockerd[7413]: time="2018-06-26T09:59:19.319000781+03:00" level=info msg="Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address"        
чер 26 09:59:19 serge dockerd[7413]: time="2018-06-26T09:59:19.481057634+03:00" level=info msg="Loading containers: done."
чер 26 09:59:19 serge dockerd[7413]: time="2018-06-26T09:59:19.549868439+03:00" level=info msg="Docker daemon" commit=7390fc6 graphdriver(s)=overlay2 version=17.12.1-ce
чер 26 09:59:19 serge dockerd[7413]: time="2018-06-26T09:59:19.549934363+03:00" level=info msg="Daemon has completed initialization"
чер 26 09:59:19 serge dockerd[7413]: time="2018-06-26T09:59:19.555499683+03:00" level=info msg="API listen on /var/run/docker.sock"
чер 26 09:59:19 serge systemd[1]: Started Docker Application Container Engine.

И я приплыл...

В ссылке выше я нашел совет :

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

u should check if current login user belongs to /var/run/docker.sock user group docker.
Try run Compose as sudo.

Не понял какую команду нужно выполнить под рутом ?

Не в сети

#3 26.06.2018 10:46:56

Re: Ошибка запуска приложение через docker

Нашел видео в котором docker-compose up -d запускается под рутом(что кажется
нелогичным - как я понял эта команда должна применяться к каждому проекту который я хочу запустить локально ?)

root@serge:/mnt/docker_test/dockerApp# docker-compose up -d
Building app
Step 1/3 : FROM php:7-fpm
 ---> 854ffd8dc9d8
Step 2/3 : RUN apt-get update && apt-get install -y libmcrypt-dev mysql-client         && docker-php-ext-install mcrypt pdo_mysql
 ---> Running in ce6d75efad2c
Get:1 [url]http://security.debian.org/debian-security[/url] stretch/updates InRelease [94.3 kB]
Ign:2 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch InRelease
Get:3 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch-updates InRelease [91.0 kB]
Get:5 [url]http://security.debian.org/debian-security[/url] stretch/updates/main amd64 Packages [450 kB]
Get:4 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch Release [118 kB]
Get:6 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch-updates/main amd64 Packages [12.1 kB]
Get:7 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch Release.gpg [2434 B]
Get:8 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 Packages [9530 kB]
Fetched 10.3 MB in 3s (3042 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  default-mysql-client libaio1 libdbd-mysql-perl libdbi-perl libjemalloc1
  libmariadbclient18 libmcrypt4 libreadline5 libterm-readkey-perl
  mariadb-client-10.1 mariadb-client-core-10.1 mariadb-common mysql-common
  readline-common
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl mcrypt
  readline-doc
The following NEW packages will be installed:
  default-mysql-client libaio1 libdbd-mysql-perl libdbi-perl libjemalloc1
  libmariadbclient18 libmcrypt-dev libmcrypt4 libreadline5
  libterm-readkey-perl mariadb-client-10.1 mariadb-client-core-10.1
  mariadb-common mysql-client mysql-common readline-common
0 upgraded, 16 newly installed, 0 to remove and 7 not upgraded.
Need to get 13.1 MB of archives.
After this operation, 79.8 MB of additional disk space will be used.
Get:1 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 readline-common all 7.0-3 [70.4 kB]
Get:2 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 mysql-common all 5.8+1.0.2 [5608 B]
Get:3 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 mariadb-common all 10.1.26-0+deb9u1 [27.3 kB]
Get:4 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libaio1 amd64 0.3.110-3 [9412 B]
Get:5 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libreadline5 amd64 5.2+dfsg-3+b1 [119 kB]
Get:6 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 mariadb-client-core-10.1 amd64 10.1.26-0+deb9u1 [5042 kB]
Get:7 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libjemalloc1 amd64 3.6.0-9.1 [89.8 kB]
Get:8 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 mariadb-client-10.1 amd64 10.1.26-0+deb9u1 [5841 kB]
Get:9 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 default-mysql-client all 1.0.2 [3050 B]
Get:10 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libdbi-perl amd64 1.636-1+b1 [766 kB]
Get:11 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libmariadbclient18 amd64 10.1.26-0+deb9u1 [779 kB]
Get:12 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libdbd-mysql-perl amd64 4.041-2 [114 kB]
Get:13 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libmcrypt4 amd64 2.5.8-3.3 [71.2 kB]
Get:14 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libmcrypt-dev amd64 2.5.8-3.3 [92.9 kB]
Get:15 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 libterm-readkey-perl amd64 2.37-1 [27.2 kB]
Get:16 [url]http://cdn-fastly.deb.debian.org/debian[/url] stretch/main amd64 mysql-client amd64 5.5.9999+default [1698 B]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 13.1 MB in 2s (5851 kB/s)
Selecting previously unselected package readline-common.
(Reading database ... 12273 files and directories currently installed.)
Preparing to unpack .../00-readline-common_7.0-3_all.deb ...
Unpacking readline-common (7.0-3) ...
Selecting previously unselected package mysql-common.
Preparing to unpack .../01-mysql-common_5.8+1.0.2_all.deb ...
Unpacking mysql-common (5.8+1.0.2) ...
Selecting previously unselected package mariadb-common.
Preparing to unpack .../02-mariadb-common_10.1.26-0+deb9u1_all.deb ...
Unpacking mariadb-common (10.1.26-0+deb9u1) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../03-libaio1_0.3.110-3_amd64.deb ...
Unpacking libaio1:amd64 (0.3.110-3) ...
Selecting previously unselected package libreadline5:amd64.
Preparing to unpack .../04-libreadline5_5.2+dfsg-3+b1_amd64.deb ...
Unpacking libreadline5:amd64 (5.2+dfsg-3+b1) ...
Selecting previously unselected package mariadb-client-core-10.1.
Preparing to unpack .../05-mariadb-client-core-10.1_10.1.26-0+deb9u1_amd64.deb ...
Unpacking mariadb-client-core-10.1 (10.1.26-0+deb9u1) ...
Selecting previously unselected package libjemalloc1.
Preparing to unpack .../06-libjemalloc1_3.6.0-9.1_amd64.deb ...
Unpacking libjemalloc1 (3.6.0-9.1) ...
Selecting previously unselected package mariadb-client-10.1.
Preparing to unpack .../07-mariadb-client-10.1_10.1.26-0+deb9u1_amd64.deb ...
Unpacking mariadb-client-10.1 (10.1.26-0+deb9u1) ...
Selecting previously unselected package default-mysql-client.
Preparing to unpack .../08-default-mysql-client_1.0.2_all.deb ...
Unpacking default-mysql-client (1.0.2) ...
Selecting previously unselected package libdbi-perl.
Preparing to unpack .../09-libdbi-perl_1.636-1+b1_amd64.deb ...
Unpacking libdbi-perl (1.636-1+b1) ...
Selecting previously unselected package libmariadbclient18:amd64.
Preparing to unpack .../10-libmariadbclient18_10.1.26-0+deb9u1_amd64.deb ...
Unpacking libmariadbclient18:amd64 (10.1.26-0+deb9u1) ...
Selecting previously unselected package libdbd-mysql-perl.
Preparing to unpack .../11-libdbd-mysql-perl_4.041-2_amd64.deb ...
Unpacking libdbd-mysql-perl (4.041-2) ...
Selecting previously unselected package libmcrypt4.
Preparing to unpack .../12-libmcrypt4_2.5.8-3.3_amd64.deb ...
Unpacking libmcrypt4 (2.5.8-3.3) ...
Selecting previously unselected package libmcrypt-dev.
Preparing to unpack .../13-libmcrypt-dev_2.5.8-3.3_amd64.deb ...
Unpacking libmcrypt-dev (2.5.8-3.3) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../14-libterm-readkey-perl_2.37-1_amd64.deb ...
Unpacking libterm-readkey-perl (2.37-1) ...
Selecting previously unselected package mysql-client.
Preparing to unpack .../15-mysql-client_5.5.9999+default_amd64.deb ...
Unpacking mysql-client (5.5.9999+default) ...
Setting up readline-common (7.0-3) ...
Setting up libjemalloc1 (3.6.0-9.1) ...
Setting up mysql-common (5.8+1.0.2) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up libmariadbclient18:amd64 (10.1.26-0+deb9u1) ...
Setting up libterm-readkey-perl (2.37-1) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
Setting up libaio1:amd64 (0.3.110-3) ...
Setting up libreadline5:amd64 (5.2+dfsg-3+b1) ...
Setting up libmcrypt4 (2.5.8-3.3) ...
Setting up libdbi-perl (1.636-1+b1) ...
Setting up mariadb-common (10.1.26-0+deb9u1) ...
update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up mariadb-client-core-10.1 (10.1.26-0+deb9u1) ...
Setting up libmcrypt-dev (2.5.8-3.3) ...
Setting up libdbd-mysql-perl (4.041-2) ...
Setting up mariadb-client-10.1 (10.1.26-0+deb9u1) ...
Setting up default-mysql-client (1.0.2) ...
Setting up mysql-client (5.5.9999+default) ...
Processing triggers for libc-bin (2.24-11+deb9u3) ...
error: /usr/src/php/ext/mcrypt does not exist

usage: /usr/local/bin/docker-php-ext-install [-jN] ext-name [ext-name ...]
   ie: /usr/local/bin/docker-php-ext-install gd mysqli
       /usr/local/bin/docker-php-ext-install pdo pdo_mysql
       /usr/local/bin/docker-php-ext-install -j5 gd mbstring mysqli pdo pdo_mysql shmop

if custom ./configure arguments are necessary, see docker-php-ext-configure

Possible values for ext-name:
bcmath bz2 calendar ctype curl dba dom enchant exif fileinfo filter ftp gd gettext gmp hash iconv imap interbase intl json ldap mbstring mysqli oci8 odbc opcache pcntl pdo pdo_dblib pdo_firebird pdo_mysql pdo_oci pdo_odbc pdo_pgsql pdo_sqlite pgsql phar posix pspell readline recode reflection session shmop simplexml snmp soap sockets sodium spl standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xml xmlreader xmlrpc xmlwriter xsl zend_test zip

Some of the above modules are already compiled into PHP; please check
the output of "php -i" to see which modules are already loaded.
ERROR: Service 'app' failed to build: The command '/bin/sh -c apt-get update && apt-get install -y libmcrypt-dev mysql-client         && docker-php-ext-install mcrypt pdo_mysql' returned a non-zero code: 1

Если запустить команду в конце вывода под рутом в консоле то получаю ошибку :

root@serge:/mnt/_work_sdb8/wwwroot/docker_test/dockerApp# apt-get update && apt-get install -y libmcrypt-dev mysql-client         && docker-php-ext-install mcrypt pdo_mysql
Hit:1 [url]http://ua.archive.ubuntu.com/ubuntu[/url] bionic InRelease
Hit:2 [url]http://ua.archive.ubuntu.com/ubuntu[/url] bionic-updates InRelease                                                                                                                                                             
Hit:3 [url]http://ua.archive.ubuntu.com/ubuntu[/url] bionic-backports InRelease                                                                                                                                                           
Ign:4 [url]http://dl.google.com/linux/chrome/deb[/url] stable InRelease                                                                                                                                                                                
Hit:5 [url]http://ppa.launchpad.net/clipgrab-team/ppa/ubuntu[/url] bionic InRelease                                                                                                                                                                    
Hit:6 [url]https://deb.nodesource.com/node_10.x[/url] bionic InRelease                                                                                                                                                                                 
Hit:7 [url]http://dl.google.com/linux/chrome/deb[/url] stable Release                                                                                                                                                                                  
Hit:8 [url]https://repo.skype.com/deb[/url] stable InRelease                                                                                                                     
Hit:9 [url]http://ppa.launchpad.net/graphics-drivers/ppa/ubuntu[/url] bionic InRelease                                                                     
Get:10 [url]http://security.ubuntu.com/ubuntu[/url] bionic-security InRelease [83,2 kB]
Fetched 83,2 kB in 1s (104 kB/s)                                  
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libmcrypt-dev is already the newest version (2.5.8-3.3).
mysql-client is already the newest version (5.7.22-0ubuntu18.04.1).
The following packages were automatically installed and are no longer required:
  gyp libjs-async libjs-inherits libjs-node-uuid libssl-dev libssl-doc libuv1-dev
Use 'apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.
docker-php-ext-install: command not found

А что это за docker-php-ext-install и почему он не найден ?

Не в сети

Подвал раздела