====== Примеры ====== ===== Пример php приложения ===== == Dockerfile == FROM centos:7 ENV ORACLE_HOME=/usr/lib/oracle/12.1/client64 ENV LD_LIBRARY_PATH=/usr/lib/oracle/12.1/client64/lib ENV LD_LIBRARY_PATH64=/usr/lib/oracle/12.1/client64/lib ENV NSS_SDB_USE_CACHE=yes COPY oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm /tmp/ RUN yum install -y /tmp/oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm \ && rm -f /tmp/*.rpm RUN yum clean all \ && yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ && yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm \ && yum-config-manager --enable remi-php56 \ && yum install -y php-cli php-fpm php-gd php-mbstring php-mysqlnd php-oci8 php-pecl-memcache php-soap \ && yum install -y curl net-tools tcpdump telnet \ && yum clean all COPY etc/php.ini etc/php-fpm.conf /etc/ COPY etc/php-fpm.d/www.conf /etc/php-fpm.d/ CMD ["/usr/sbin/php-fpm", "--nodaemonize"] == Создание образа == docker build --no-cache -t php56 . == Добавление образа в репозиторий == docker tag php56 ak831/php56 docker push ak831/php56 == Загрузка образа == docker pull ak831/php56:latest == Запуск контейнера == docker run --name pe -d \ --network="host" \ --mount type=bind,source=/usr/local/pe,target=/usr/local/pe \ --mount type=bind,source=/usr/local/pe/log,target=/var/log/php-fpm \ --restart unless-stopped \ ak831/php56:latest == Подключение к контейнеру == docker exec -i -t pe2 bash docker exec -ti --user postgres a2db_postgres_1 psql === C отдельными томами и сетевым мостом === == Создание томов == docker volume create pe-data docker volume create pe-logs == Запуск контейнера == docker run --name pe -d \ -p 127.0.0.1:9009:9009 \ --mount source=pe-data,target=/usr/local/pe \ --mount source=pe-logs,target=/var/log/php-fpm \ --restart unless-stopped \ ak831/php56:latest {{tag> docker php }}