Memcached >= 2.2.0 is required. Symfony and Docker - docker

Here's what I've tried..
docker-compose.yml
version: '3'
services:
#PHP Service
app:
build:
context: .
dockerfile: Dockerfile
image: digitalocean.com/php
container_name: app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
#Nginx Service
webserver:
image: nginx:alpine
container_name: webserver
restart: unless-stopped
tty: true
ports:
- "8235:80"
- "455:443"
volumes:
- ./:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
- ./nginx/ssl:/etc/nginx/ssl
networks:
- app-network
# try this...
memcached:
container_name: memcached
image: memcached:latest
ports:
- "11212:11211"
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
Dockerfile
# ... omitted for brevity
# try this..
RUN apt-get update && apt-get install -y \
memcached
# now try this...
RUN docker-php-ext-install libz-dev libmemcached-dev
RUN docker-php-ext-install pecl install memcached
RUN docker-php-ext-install docker-php-ext-enable memcached
# and this...
RUN docker-php-ext-install build-essential libmemcached-dev libz-dev
RUN pecl install memcached-2.2.0
RUN echo extension=memcached.so >> /usr/local/etc/php/conf.d/memcached.ini
The local site is up and serving files (Symfony) only I'm met with the memcached exception:
Any ideas?

Dropping this in my Dockerfile fixed it
RUN apt-get update && apt-get install -y libmemcached-dev \
&& pecl install memcached \
&& docker-php-ext-enable memcached

Related

My web turn on witch docker-compose.yml but not my dockerfile

I work on a deployement of Prestashop image but when i use docker-compose up -d --build it work. I have access to Prestashop install page. But when i do build -t prestashop:latest . to build it and use docker run -d --name prestashop -p 80:80 prestashop:latest to run it. I fall on the apache homepage. Thank you in advance
Dockerfile
FROM ubuntu:18.04
RUN \
sed -i 's/# \(.*multiverse$\)/\1/g' /etc/apt/sources.list && \
apt-get update && \
apt-get -y upgrade && \
apt-get install -y build-essential && \
apt-get install -y software-properties-common && \
apt-get install -y byobu curl git htop man unzip vim wget && \
rm -rf /var/lib/apt/lists/*
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get upgrade
RUN apt-get install -y apache2 libapache2-mod-php
RUN apt install -y php unzip
RUN apt-get install -y php-cli php-common php-mbstring php-gd php-intl php-xml php-mysql php-zip php-curl php-xmlrpc
COPY . /var/www/html:rw
COPY ./config/presta.conf /etc/apache2/sites-available/000-default.conf
RUN a2enmod rewrite
WORKDIR /var/www/html
EXPOSE 80
CMD apachectl -D FOREGROUND
docker-compose.yml
version: '2'
services:
mysql:
image: mysql:5.7
env_file:
- .env
volumes:
- ./.docker/data/mysql/:/var/lib/mysql
- ./.docker/logs/mysql/:/var/log/mysql
ports:
- "3306:3306"
container_name: presta_mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- 8080:80
env_file:
- .env
environment:
PMA_HOST: mysql
VIRTUAL_HOST: phpmyadmin.presta.local
container_name: presta_phpmyadmin
app_dev:
container_name: presta_app
build: .
environment:
- VIRTUAL_HOST=app.presta.local
volumes :
- ./:/var/www/html:rw
restart: always
ports:
- 80:80
links:
- "mysql:presta_mysql"
Before you go into it, I recommend you to read docker documentation.
There are a few main topics you need to understand first:
https://docs.docker.com/storage/volumes/
version: '2'
services:
mysql:
image: mysql:5.7
env_file:
- .env
volumes:
- "./.docker/data/mysql/:/var/lib/mysql:rw"
- "./.docker/logs/mysql/:/var/log/mysql:rw"
ports:
- "3306:3306"
container_name: presta_mysql
phpmyadmin:
image: phpmyadmin/phpmyadmin
ports:
- "8080:80"
env_file:
- .env
environment:
PMA_HOST: mysql
VIRTUAL_HOST: phpmyadmin.presta.local
container_name: presta_phpmyadmin
app_dev:
container_name: presta_app
build: .
environment:
- VIRTUAL_HOST=app.presta.local
volumes :
- "./:/var/www/html:rw"
restart: always
ports:
- "80:80"
links:
- "mysql:presta_mysql"

Kubernetes: Can't Run Kompose Up While Deploying Laravel App

i'm new in DevOps tried to deploying Laravel app (from my bootcamp source code) to Kubernetes in my local machine (CentOS 7), i have problem when convert my docker-compose.yml with Kompose especially in volume mount. Can you tell me how to solve this problem? I have tried troubleshoot but not succeeded.
Here is my docker-compose.yml file:
version: '3'
services:
#PHP Service
app:
build:
context: .
dockerfile: Dockerfile
image: php
container_name: app
restart: unless-stopped
tty: true
environment:
SERVICE_NAME: app
SERVICE_TAGS: dev
working_dir: /var/www
volumes:
- ./:/var/www
- ./php/local.ini:/usr/local/etc/php/conf.d/local.ini
networks:
- app-network
#Nginx Service
webserver:
image: nginx:alpine
container_name: webserver
restart: unless-stopped
tty: true
ports:
- "80:80"
- "443:443"
volumes:
- ./:/var/www
- ./nginx/conf.d/:/etc/nginx/conf.d/
networks:
- app-network
#MySQL Service
db:
image: mysql:5.7.22
container_name: db
restart: unless-stopped
tty: true
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: laravel
MYSQL_ROOT_PASSWORD: nightraven
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- dbdata:/var/lib/mysql/
- ./mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
#Docker Networks
networks:
app-network:
driver: bridge
#Volumes
volumes:
dbdata:
driver: local
and this is Dockerfile i create for Laravel app:
FROM php:7.2-fpm
# Copy composer.lock and composer.json
COPY composer.lock composer.json /var/www/
# Set working directory
WORKDIR /var/www
# Install dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libpng-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
locales \
zip \
jpegoptim optipng pngquant gifsicle \
vim \
unzip \
git \
curl
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
# Install extensions
RUN docker-php-ext-install pdo_mysql mbstring zip exif pcntl
RUN docker-php-ext-configure gd --with-gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ --with-png-dir=/usr/include/
RUN docker-php-ext-install gd
# Install composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Add user for laravel application
RUN groupadd -g 1000 www
RUN useradd -u 1000 -ms /bin/bash -g www www
# Copy existing application directory contents
COPY . /var/www
# Copy existing application directory permissions
COPY --chown=www:www . /var/www
# Change current user to www
USER www
# Expose port 9000 and start php-fpm server
EXPOSE 9000
CMD ["php-fpm"]
And this is the error:
https://i.stack.imgur.com/LtKka.png
it's said
FATA Error while deploying application: k.Transform failed: Unable to
build Docker image for service app: Unable to create a tarball:
archive/tar: write too long

Docker: need to persist folder in symfony project

I'm trying to dockerize my Symfony project.
In this project, I have a folder under: public/fichiersflux/
"fichiersflux" is a folder with persistent data (img, pdf...)
Here is the docker-compose.yml:
version: '3.7'
services:
mariadb:
image: mariadb:10.4
restart: always
environment:
MYSQL_ROOT_PASSWORD: zfezZEFfz4e1589fze
MYSQL_DATABASE: 1c1t
MYSQL_USER: 1c1t
MYSQL_PASSWORD: fez45FZE1fez0fzefF!
ports:
- 3306:3306
php:
image: php:7.4
build:
context: .
dockerfile: docker/php/Dockerfile
restart: on-failure
user: 1000:1000
nginx:
image: nginx:1.17-alpine
restart: on-failure
volumes:
- './app/public/:/usr/src/app'
- './docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro'
ports:
- 8080:80
depends_on:
- php
And my Dockerfile:
# ./docker/php/Dockerfile
FROM php:7.4-fpm
RUN docker-php-ext-install pdo_mysql
RUN pecl install apcu
RUN apt-get update && \
apt-get install -y \
zlib1g-dev
RUN apt-get install -y \
libzip-dev \
libicu-dev \
zip \
&& docker-php-ext-install zip
RUN docker-php-ext-enable apcu \
&& docker-php-ext-install intl
# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /usr/src/app
COPY app/ /usr/src/app
RUN chown -R 1000:1000 /usr/src/app
RUN PATH=$PATH:/usr/src/apps/vendor/bin:bin
The problem is, when I build my docker containers, the folder /usr/src/app/ is apparently re-created.. and I loose all data inside public/fichiersflux
How can I persist public/fichiersflux folder ?
Best regards :)
You could just add volumes on php services, to mount your target folder.
version: '3.7'
services:
mariadb:
image: mariadb:10.4
restart: always
environment:
MYSQL_ROOT_PASSWORD: zfezZEFfz4e1589fze
MYSQL_DATABASE: 1c1t
MYSQL_USER: 1c1t
MYSQL_PASSWORD: fez45FZE1fez0fzefF!
ports:
- 3306:3306
php:
image: php:7.4
build:
context: .
dockerfile: docker/php/Dockerfile
volumes:
- '../app/public/fichiersflux:/usr/src/app/fichiersflux'
restart: on-failure
user: 1000:1000
nginx:
image: nginx:1.17-alpine
restart: on-failure
volumes:
- './app/public/:/usr/src/app'
- './docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro'
ports:
- 8080:80
depends_on:
- php

Installing docker with nginx-proxy I got docker-php-ext-install not found error

I need to install laravel 5 app on Digital Ocean Server (under kubuntu 18) using Docker with VIRTUAL_HOST pointing to my my.freenom.com
host using proxy server (https://github.com/jwilder/nginx-proxy) and for this in my app I use configuraion
docker-compose.yml:
version: '3.1'
services:
web:
image: jwilder/nginx-proxy
build:
context: ./web
dockerfile: Dockerfile.yml
environment:
- APACHE_RUN_USER =#1000
- VIRTUAL_HOST =my.freenom.com
volumes:
- ./mysite.template:/etc/nginx/conf.d/mysite.template
ports:
- 8085:80
working_dir: ${APP_PTH_CONTAINER}
db:
image: mysql:5.5.62
restart: always
environment:
MYSQL_ROOT_PASSWORD: 1
volumes:
- ${DB_PATH_HOST}:/var/lib/mysql
adminer:
image: adminer
restart: always
ports:
- 8086:80
links:
- db
composer:
image: composer:1.6
volumes:
- ${APP_PATH_HOST}:${APP_PTH_CONTAINER}
working_dir: ${APP_PTH_CONTAINER}
command: composer install --ignore-platform-reqs
and in web/Dockerfile.yml :
FROM nginx:1.10
RUN apt-get update -y && apt-get install -y libpng-dev \
nano libmcrypt-dev
RUN docker-php-ext-install \
pdo_mysql \
mcrypt \
&& a2enmod \
rewrite
but running command :
docker-compose up -d --build
I got error :
docker-php-ext-install: not found
Why error and which is correct way?
Thanks!

PhpStorm does not recognize remote debugger from docker(-compose)

My dockerfile
FROM php:7.0-apache
RUN pecl install -o -f redis
RUN pecl install -o -f xdebug
RUN docker-php-ext-enable redis
RUN docker-php-ext-enable xdebug
RUN docker-php-ext-install pdo pdo_mysql mysqli
RUN apt-get update
RUN apt-get install locales-all -y
My docker-compose file
version: "3.7"
services:
redis:
restart: unless-stopped
image: redis:alpine
container_name: redis_mp
volumes:
- redis-data:/data
# if we need a custom redis configuration
# - ./docker//usr/local/etc/redis/redis.conf:/usr/local/etc/redis/redis.conf
mysql:
restart: unless-stopped
image: mysql:5.6
container_name: mysql_mp
command: --default-authentication-plugin=mysql_native_password
ports:
# So you can use a database client on your host machine
- 3306:3306
environment:
- MYSQL_ROOT_PASSWORD=secret
volumes:
- mysql-data:/var/lib/mysql
# if we need a custom mysql configuration
# - ./docker/etc/mysql/conf.d:/etc/mysql/conf.d
apache:
restart: unless-stopped
# image: php:7.2-apache
build: ./docker/Dockerfiles/apache
container_name: apache_mp
# command: bash -c "docker-php-ext-install pdo pdo_mysql && service apache2 restart"
depends_on:
- mysql
- redis
- certbot
ports:
# Exposing both http and https
- 80:80
- 443:443
environment:
- APACHE_DOCUMENT_ROOT=/var/www/html/public/
volumes:
- .:/home/medpets/WWW/
- ./docker/etc/apache2:/etc/apache2/
- ./docker/usr/local/etc/php/php.ini:/usr/local/etc/php/php.ini
- apache-log:/home/medpets/LOG/
- ./docker/etc/letsencrypt:/etc/letsencrypt/
- ./docker/etc/ssl:/etc/ssl/
certbot:
restart: "no"
image: certbot/certbot
container_name: certbot_mp
volumes:
- ./docker/etc/letsencrypt:/etc/letsencrypt/
volumes:
mysql-data:
redis-data:
apache-log:
The problem

Resources