Does USB read-rate from a camera device degrade when running inside of a docker container?

I have a general question regarding usb device performance inside of a docker container.

For context, I have setup a docker image (for deploying containers on an nvidia jetson agx xavier platform) to set up a camera publisher in ros to stream data from a realsense d435i camera plugged into the jetson via USB 3.2. I run this container with the --privileged option, as well as mounting the host volume /dev via -v /dev:/dev in the run command and I am able to bring up the node and run pretty reliably @15 fps at the camera’s lowest resolution. Additionally, I am able to view the camera stream on a separate host machine (connected over wlan) and the output looks pretty good.

I am trying to identify potential reasons why I cannot increase the frame-rate or the resolution without causing my ros node to crash. One of the issues, potentially, is the read-rate of my usb device when being read from within a running container. I am new to docker, and I would appreciate any general info and/or links about how running a docker container on a host machine can impact usb performance. Any relevant info would be of great use to me. Thanks!

Unable to host Speech Recognition and Sound Playing Application on Docker

I have an application that takes voice input from microphone, performs speech recognition and plays certain music files based on the cue words recognized. This application is in Python and implements a couple of python modules like PyAudio, Playsound and Websocket-client. I am trying to build a Docker image of this application.

I have created a Dockerfile with below contents:

FROM ubuntu ADD . /app  FROM python:3 ADD transcribe.py / ADD speech.cfg / ADD setup.cfg /  ADD setup.py /  RUN apt-get update RUN apt-get --assume-yes install libasound-dev portaudio19-dev     libportaudio2 libportaudiocpp0 RUN pip3 install pyaudio RUN pip3 install websocket-client RUN pip3 install playsound CMD [ "python3", "./transcribe.py" ] 

When trying to build it, I get a successful build response as below:

ABCDEFG:random-folder User$   docker build -t storyassist . Sending build context to Docker daemon  3.494MB Step 1/13 : FROM ubuntu  ---> 4c108a37151f Step 2/13 : ADD . /app  ---> e520eb6d11e8 Step 3/13 : FROM python:3  ---> 42d620af35be Step 4/13 : ADD transcribe.py /  ---> 6c76aee20537 Step 5/13 : ADD speech.cfg /  ---> 74c3221f2324 Step 6/13 : ADD setup.cfg /  ---> 2c415c19a4fb Step 7/13 : ADD setup.py /  ---> c6382077cdcf Step 8/13 : RUN apt-get update  ---> Running in ace9adab6a44 Get:1 http://deb.debian.org/debian buster InRelease [118 kB] Get:2 http://deb.debian.org/debian buster-updates InRelease [46.8 kB] Get:3 http://deb.debian.org/debian buster/main amd64 Packages [7897 kB] Get:4 http://security.debian.org/debian-security buster/updates     InRelease [39.1 kB] Get:5 http://security.debian.org/debian-security     buster/updates/main amd64 Packages [42.5 kB] Fetched 8143 kB in 3s (2493 kB/s) Reading package lists... Removing intermediate container ace9adab6a44  ---> d46db350b95f Step 9/13 : RUN apt-get --assume-yes install libasound-dev     portaudio19-dev libportaudio2 libportaudiocpp0  ---> Running in 8d772b088b15 Reading package lists... Building dependency tree... Reading state information... The following additional packages will be installed:   libasound2 libasound2-data libjack-dev libjack0 Suggested packages:   libasound2-plugins alsa-utils libasound2-doc jackd1 portaudio19-doc The following NEW packages will be installed:   libasound2 libasound2-data libasound2-dev libjack-dev libjack0     libportaudio2   libportaudiocpp0 portaudio19-dev 0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. Need to get 1094 kB of archives. After this operation, 5886 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian buster/main amd64 libasound2-    data all 1.1.8-1 [59.6 kB] Get:2 http://deb.debian.org/debian buster/main amd64 libasound2     amd64 1.1.8-1 [361 kB] Get:3 http://deb.debian.org/debian buster/main amd64 libasound2-dev     amd64 1.1.8-1 [145 kB] Get:4 http://deb.debian.org/debian buster/main amd64 libjack0 amd64     1:0.125.0-3 [109 kB] Get:5 http://deb.debian.org/debian buster/main amd64 libjack-dev     amd64 1:0.125.0-3 [227 kB] Get:6 http://deb.debian.org/debian buster/main amd64 libportaudio2     amd64 19.6.0-1 [66.6 kB] Get:7 http://deb.debian.org/debian buster/main amd64     libportaudiocpp0 amd64 19.6.0-1 [18.8 kB] Get:8 http://deb.debian.org/debian buster/main amd64 portaudio19-    dev amd64 19.6.0-1 [108 kB] debconf: delaying package configuration, since apt-utils is not     installed Fetched 1094 kB in 1s (1381 kB/s) Selecting previously unselected package libasound2-data. (Reading database ... 24544 files and directories currently     installed.) Preparing to unpack .../0-libasound2-data_1.1.8-1_all.deb ... Unpacking libasound2-data (1.1.8-1) ... Selecting previously unselected package libasound2:amd64. Preparing to unpack .../1-libasound2_1.1.8-1_amd64.deb ... Unpacking libasound2:amd64 (1.1.8-1) ... Selecting previously unselected package libasound2-dev:amd64. Preparing to unpack .../2-libasound2-dev_1.1.8-1_amd64.deb ... Unpacking libasound2-dev:amd64 (1.1.8-1) ... Selecting previously unselected package libjack0:amd64. Preparing to unpack .../3-libjack0_1%3a0.125.0-3_amd64.deb ... Unpacking libjack0:amd64 (1:0.125.0-3) ... Selecting previously unselected package libjack-dev. Preparing to unpack .../4-libjack-dev_1%3a0.125.0-3_amd64.deb ... Unpacking libjack-dev (1:0.125.0-3) ... Selecting previously unselected package libportaudio2:amd64. Preparing to unpack .../5-libportaudio2_19.6.0-1_amd64.deb ... Unpacking libportaudio2:amd64 (19.6.0-1) ... Selecting previously unselected package libportaudiocpp0:amd64. Preparing to unpack .../6-libportaudiocpp0_19.6.0-1_amd64.deb ... Unpacking libportaudiocpp0:amd64 (19.6.0-1) ... Selecting previously unselected package portaudio19-dev:amd64. Preparing to unpack .../7-portaudio19-dev_19.6.0-1_amd64.deb ... Unpacking portaudio19-dev:amd64 (19.6.0-1) ... Setting up libasound2-data (1.1.8-1) ... Setting up libjack0:amd64 (1:0.125.0-3) ... Setting up libasound2:amd64 (1.1.8-1) ... Setting up libjack-dev (1:0.125.0-3) ... Setting up libasound2-dev:amd64 (1.1.8-1) ... Setting up libportaudio2:amd64 (19.6.0-1) ... Setting up libportaudiocpp0:amd64 (19.6.0-1) ... Setting up portaudio19-dev:amd64 (19.6.0-1) ... Processing triggers for libc-bin (2.28-10) ... Removing intermediate container 8d772b088b15  ---> d2bc72b4654c Step 10/13 : RUN pip3 install pyaudio  ---> Running in 654227a7b259 Collecting pyaudio   Downloading         https://files.pythonhosted.org/packages/ab/42/b4f04721c5c5bfc196ce156b3    c768998ef8c0ae3654ed29ea5020c749a6b/PyAudio-0.2.11.tar.gz Building wheels for collected packages: pyaudio   Building wheel for pyaudio (setup.py): started   Building wheel for pyaudio (setup.py): finished with status     'done'   Stored in directory:     /root/.cache/pip/wheels/f4/a8/a4/292214166c2917890f85b2f72a8e5f13e1ffa5    27c4200dcede Successfully built pyaudio Installing collected packages: pyaudio Successfully installed pyaudio-0.2.11 Removing intermediate container 654227a7b259  ---> 1336a7cbfb0f Step 11/13 : RUN pip3 install websocket-client  ---> Running in dfa7c4d9f195 Collecting websocket-client   Downloading         https://files.pythonhosted.org/packages/29/19/44753eab1fdb50770ac696055    27e8859468f3c0fd7dc5a76dd9c4dbd7906/websocket_client-0.56.0-py2.py3-    none-any.whl (200kB) Collecting six (from websocket-client)   Downloading     https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238    ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl Installing collected packages: six, websocket-client Successfully installed six-1.12.0 websocket-client-0.56.0 Removing intermediate container dfa7c4d9f195  ---> e82fd88cd21a Step 12/13 : RUN pip3 install playsound  ---> Running in 2f2af7ce7bdc Collecting playsound   Downloading         https://files.pythonhosted.org/packages/f5/16/10d897b0a83fb4b05b03a63d7    a2667ab75f857f67f7062fd447dd3f49bf7/playsound-1.2.2-py2.py3-none-any.whl Installing collected packages: playsound Successfully installed playsound-1.2.2 Removing intermediate container 2f2af7ce7bdc  ---> ac6c2e571e3b Step 13/13 : CMD [ "python3", "./transcribe.py" ]  ---> Running in 11291eaff8f4 Removing intermediate container 11291eaff8f4  ---> 2d8cd222b2bb Successfully built 2d8cd222b2bb Successfully tagged storyassist:latest 

But when I try to runt his image, I get a bunch of errors where I my docker image cannot find the drivers specified. While its is possible to resolve similar issues in Virtual Machines, I am not sure if there is a simple way to resolve the same in docker containers.

ABCDEFG:random-folder User$   docker run storyassist ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4568:(_snd_config_evaluate) function     snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM sysdefault ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM sysdefault ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.iec958 ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM default ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM default ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4568:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5047:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM dmix Exception in thread Thread-1: Traceback (most recent call last):   File "/usr/local/lib/python3.7/threading.py", line 926, in     _bootstrap_inner     self.run()   File "/usr/local/lib/python3.7/threading.py", line 870, in run     self._target(*self._args, **self._kwargs)   File "./transcribe.py", line 83, in read_audio     RATE = int(p.get_default_input_device_info()    ['defaultSampleRate'])   File "/usr/local/lib/python3.7/site-packages/pyaudio.py", line     949, in get_default_input_device_info     device_index = pa.get_default_input_device() OSError: No Default Input Device Available 

How to install Docker Ubuntu 18.04 with https proxy error

I have an issue of installing Docker on ubuntu 18.04

When I try the following lines I get an https error due to there being no http version and we are behind a company proxy so it fails.

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"  sudo apt update 

Fails with.

Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. 

Is there an alternative way to install even for a one of version using curl or wget?

Is there a way of bypassing a proxy in the apt conf to tell it to ignore the certificate error?

Docker Container is much more slower than Server

  1. Server: Im using Ubuntu 18.10 and run magento2.3.1 with redis, varnish end elasticsearch.

    • when clear the cache, ubuntu take only 10-20seconds to reload the page.
    • when running setup:static-content:deploy ubuntu take 50seconds to finish
    • with varnish cache, it takes 1second to reload the page
  2. Docker: I create a docker-compose on my ubuntu server, no volume added

    • when clear the cache, docker take 1-2min to reload the page
    • when running setup:static-content:deploy docker take 300seconds (5min) to finish
    • with varnish cache, it takes 1second the same as Ubuntu Server.

My question is what happen to Docker that take the deploy time so long? Im thinking of read/write files speed b/w Docker and Server are different, Docker read/write speed is much slower than ubuntu.

Below are my docker-compose and Dockerfile

docker-compose.yml version: '3.7' services:   web:     build: ./projectx     networks:       - magento_bacth_net       - 94now_elasticsearch_net     container_name: magento_bacth_web     links:       - db       - redis     ports:       - "8080:80"     env_file:       - .env       - database.env   redis:     build: ./redis     networks:       - magento_bacth_net     container_name: magento_bacth_redis   varnish:     build: ./varnish     networks:       - magento_bacth_net     container_name: magento_bacth_varnish     depends_on:       - web     ports:       - "8082:82"   db:     image: mysql:5.7.26     networks:       - magento_bacth_net     container_name: magento_bacth_db     environment:       - MYSQL_ROOT_PASSWORD=ecomsys       - MYSQL_USER=ecomsys       - MYSQL_PASSWORD=ecomsys       - MYSQL_DATABASE=magento_ecomsys networks:   magento_bacth_net:     name: magento_bacth_net     ipam:       driver: default       config:         - subnet: "170.10.10.16/29"   94now_elasticsearch_net:     external:       name: 94now_elasticsearch_net  project: Dockerfile FROM centos:latest  ENV INSTALL_DIR /home/ecommage/public_html ENV SETUP_FOLDER /home/ecommage/bamboo_setup ENV COMPOSER_HOME /home/ecommage/.composer/ ENV SSH_HOME /home/ecommage/.ssh/  RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \  && rpm -Uvh https://rpms.remirepo.net/enterprise/remi-release-7.rpm  # normal updates RUN yum -y update  # php && httpd RUN yum -y install php72 php72-php php72-php-opcache php72-php-bcmath php72-php-cli php72-php-common php72-php-gd php72-php-intl php72-php-json php72-php-mbstring php72-php-pdo php72-php-pdo-dblib php72-php-pear php72-php-pecl-mcrypt php72-php-xmlrpc php72-php-xml php72-php-mysql php72-php-soap php72-php-pecl-zip php72-php-pecl-mongodb php72-php-pecl-xdebug php72-php-pecl-yaml httpd  # tools RUN yum -y install epel-release iproute at curl crontabs git redis mysql htop  RUN curl -O https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm \  && rpm -U mod-pagespeed-*.rpm \  && yum clean all \  && php72 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" \  && php72 composer-setup.php --install-dir=bin --filename=composer \  && php72 -r "unlink('composer-setup.php');" \  && rm -rf /etc/localtime \  && ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime \  && ln -s /bin/php72 /bin/php  #create ecommage user RUN useradd ecommage RUN echo "ecommage:ecommage" | chpasswd  # we want some config changes COPY config/50-php_settings.ini /etc/opt/remi/php72/php.d/ COPY config/v-host.conf /etc/httpd/conf.d/  # create webserver-default directory RUN mkdir -p $  {INSTALL_DIR} COPY ./Setup $  {SETUP_FOLDER}  RUN chown -R ecommage:ecommage /home/ecommage/.  RUN su ecommage -c "mkdir -p $  {SSH_HOME}"  COPY ./install-magento /usr/local/bin/install-magento RUN chmod +x /usr/local/bin/install-magento  COPY ./install-magento-cache /usr/local/bin/install-magento-cache RUN chmod +x /usr/local/bin/install-magento-cache  COPY ./install-magento-theme /usr/local/bin/install-magento-theme RUN chmod +x /usr/local/bin/install-magento-theme  COPY ./switch-git-repos /usr/local/bin/switch-git-repos RUN chmod +x /usr/local/bin/switch-git-repos  #change apache default user to ecommage RUN sed -i 's/User apache/User ecommage/g' /etc/httpd/conf/httpd.conf RUN sed -i 's/Group apache/Group ecommage/g' /etc/httpd/conf/httpd.conf  #install modman RUN curl -SL https://raw.githubusercontent.com/colinmollenhour/modman/master/modman -o modman RUN mv ./modman /usr/local/bin/modman RUN chmod +x /usr/local/bin/modman  #give /var/opt/remi/php72/lib/php/session 777 permission RUN chmod -R 777 /var/opt/remi/php72/lib/php/session  EXPOSE 80  RUN systemctl enable httpd \  && systemctl enable crond  CMD ["/usr/sbin/init"] CMD ["/usr/sbin/httpd","-D","FOREGROUND"] 

Como fazer um clone/snapshot de um container Docker com todos os dados?

Estou tentando fazer um clone ou um snapshot de um container do Docker e todo o seu conteúdo.

Mais especificamente falando, tenho dois container onde rodam bases dados, um com Cassandra e outro com MySQL. Eles são usados em testes, por isso gostaria de peguar um Snapshot disso e copiar em outro container para poder usar sem “estragar” o original, porém não tive sucesso em fazer isso.

Pesquisando sobre backups/clone/snapshots de containers, cheguei aos comandos docker commit e docker save que salva a imagem e depois pode ser carregada em outro container, porém não tive sucesso com ambos.

O que acontece é que consigo copiar e inclusive configurações, mas não os dados das instâncias dos bancos, isso vem vazio.

Poderia gerar scripts para fazer isso, e toda vez que precisar criar um novo container e executar os scripts, mas acredito que um clone/snapshot seria mais simples e me parece algo trivial, só que não sei como fazer 🙁

Então a minha dúvida é: como fazer um backup ou snapshot de um container do Docker e criar um novo, mantendo os dados, especialmente os dados de um container com um banco de dados, suas tabelas e dados?

Docker conect mysql em outro docker-compose

Eu tenho dois docker-compose.yml

no primeiro está definido meu banco de dados:

# Docker-compose com banco mysql e postgress junto com phpmyadmin e PGADMIN version: '3' services:  # MYSQL   db:     image: mysql     container_name: db_mysql     command: --default-authentication-plugin=mysql_native_password     environment:        MYSQL_ROOT_PASSWORD: "admin"     ports:       - 3306:3306     networks:        - mysql_net   adminer:     image: adminer     restart: always     ports:       - 8081:8080     networks:        - mysql_net   # POSTGRES   postgres:     image: postgres     container_name: postgres     environment:        POSTGRES_PASSWORD: admin     ports:       - "5432:5432"   pgadmin4:     image: dpage/pgadmin4     container_name: pgadmin4     environment:        PGADMIN_DEFAULT_EMAIL: pgadmin@pgadmin.com       PGADMIN_DEFAULT_PASSWORD: admin     ports:       - "15432:80" networks:    mysql_net:     driver: bridge 

Em meu segundo docker-compose está definido uma pequena aplicação em PHP.

version: '3'  services:   nginx:     image: richarvey/nginx-php-fpm     ports:        - "8080:80"     container_name: nginx     volumes:         - ./code:/var/www/html     networks:        - mysql_net networks:   mysql_net:     external: true 

O problema é que a minha aplicação PHP não está conseguindo enxergar o banco de dados mysql, sempre retorna o erro

Warning: mysqli_connect(): php_network_getaddresses: getaddrinfo failed: Name does not resolve in /var/www/html/cap1/mysql_lista.php on line 4 

Minha string de conexão está assim: $ conn = mysqli_connect("db_mysql", 'root', 'admin', 'livros');

Se eu criar o container do mysql dentro do docker-compose que meu PHP está rodando ele funciona, mas se eu tento separar ele já da erro.

Também tentei conectar utilizando o IP do docker mysql e também não rolou.

Não sou um profundo conhecedor de DOCKER e isso ta tirando meu sono.

Agradeço se alguém puder ajudar.

Не срабатывают брейкпоинты в xdebug + phpstorm + docker

Всем доброго времени суток! Пытаюсь настроить xdebug в phpstorm с использованием docker.

У меня есть nginx на котором несколько виртуальных хостов, ниже код docker-compose.yml, урывок php-fpm Dockerfile и xdebug.ini

     version: '3.1'      volumes:       esdata01:         driver: local       esdata02:         driver: local      networks:       esnet:       frontend:       backend:       internal:         driver: bridge         ipam:           driver: default           config:             - subnet: 192.168.220.0/28      services:       nginx:         image: nginx         ports:             - "80:80"             - "443:443"         volumes:           - ./hosts:/etc/nginx/conf.d           - ./www:/var/www           - ./logs:/var/log/nginx         links:           - php         networks:           - internal        mysql:         image: mysql:5.7         ports:         - "3306:3306"         volumes:           - ./mysql:/var/lib/mysql         environment:             MYSQL_ROOT_PASSWORD: secret         networks:           - internal        # postgres:       #   image: postgres        #   ports:        #     - "3306:3306"        #   environment:       #       MYSQL_ROOT_PASSWORD: secret        adminer:         image: adminer         restart: always         ports:           - 8080:8080         networks:           - esnet        php:         build: ./images/php          links:           - mysql          volumes:           - ./www:/var/www          networks:           - internal          extra_hosts:           - "dockerhost:10.0.75.1"          environment:           XDEBUG_CONFIG: "remote_host=dockerhost remote_enable=1 idekey=PHPSTORM"           PHP_IDE_CONFIG: "serverName=Docker"        workspace:           build: ./images/workspace           volumes:             - ./www:/var/www:cached           extra_hosts:             - "dockerhost:10.0.75.1"           ports:             - "2222:22"           tty: true        elasticsearch:         image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0         container_name: elasticsearch         environment:           - node.name=elasticsearch           - discovery.seed_hosts=es02           - cluster.initial_master_nodes=elasticsearch           - cluster.name=docker-cluster           - bootstrap.memory_lock=true           - "ES_JAVA_OPTS=-Xms512m -Xmx512m"         ulimits:           memlock:             soft: -1             hard: -1         volumes:           - esdata01:/usr/share/elasticsearch/data         ports:           - 9200:9200         networks:           - esnet       # es02:       #   image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0       #   container_name: es02       #   environment:       #     - node.name=es02       #     - discovery.seed_hosts=es01       #     - cluster.initial_master_nodes=es01,es02       #     - cluster.name=docker-cluster       #     - bootstrap.memory_lock=true       #     - "ES_JAVA_OPTS=-Xms512m -Xmx512m"       #   ulimits:       #     memlock:       #       soft: -1       #       hard: -1       #   volumes:       #     - esdata02:/usr/share/elasticsearch/data       #   networks:       #     - esnet        redis:         image: redis:latest          volumes:               - ./www/redis:/data          ports:           - "6379:6379"         networks:           - esnet  
     ADD ./php.ini /usr/local/etc/php/php.ini     ADD ./xdebug.ini /usr/local/etc/php/xdebug.ini  
     xdebug.remote_host=dockerhost     xdebug.remote_connect_back=1     xdebug.remote_port=9000     xdebug.idekey=PHPSTORM      xdebug.remote_autostart=0     xdebug.remote_enable=1     xdebug.cli_color=0     xdebug.profiler_enable=0     xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling"      xdebug.remote_handler=dbgp     xdebug.remote_mode=req      xdebug.var_display_max_children=-1     xdebug.var_display_max_data=-1     xdebug.var_display_max_depth=-1  

Настраивал по инструкциям, вроде все было хорошо, валидацию проходил, но когда ставлю брейкпоинты и запускаю прослушивание, ничего не происходит. К слову, настаивал так же через laradock – все сработало.

Я так подозреваю, что это может быть связанно с тем, что в корневой директории /var/www в настройке php-fpm лежат еще несколько директорий с проектами, возможно нужна более тонкая настройка.

Прошу помочь, спасибо!

Docker run command does not works in bash script

Trying to run a docker container through a bash script. I need the container to start and exit as soon as it is started in the bash script so that I will note the time it took for starting the container. Image is a tar file, copied from another machine using save and load technique. Can run a container from the image in the terminal but not in the shell script using docker run -it imageId command.It displays error “docker:Error response from daemon:OCI runtime create failed:container_linux.go starting process caused executable file not found in $ PATH: unknown. Help is highly appreciated. Thanks

tl_start=$  (date +%s) docker load>alpine.tar tl_end$  (date +%s) tl_load=$  ((tl_end-$  tl_start)) image_id=$  (docker images -a | awk '$  2 ~/none/print{print $  3}') ts_start=$  (date +%s) docker run -i -d alpine:latest $  image_id