Home > Software engineering >  Memcached >= 2.2.0 is required. Symfony and Docker
Memcached >= 2.2.0 is required. Symfony and Docker

Time:10-18

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:

enter image description here

Any ideas?

CodePudding user response:

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