2

I have Dockerfile with a few commands:

FROM ubuntu
RUN apt-get install -y nginx php5 php5-fpm
ADD . /code

When I run docker build . command I get next error:

E: Package 'php5-fpm' has no installation candidate
INFO[0006] The command [/bin/sh -c apt-get install nginx php5 php5-fpm] returned a non-zero code: 100 

How can I start Nginx with php-fpm based on Ubuntu image?

3
  • 1
    running apt-get update before apt-get install [...] does not solve the problem ? Commented Apr 26, 2015 at 9:55
  • Have you considered using the official php image? registry.hub.docker.com/_/php Commented Apr 26, 2015 at 14:32
  • @MarkO'Connor, No, I'm in indecision to use official PHP, Nginx or make custom image manually based on Ubuntu. There is also a problem that php and nginx official images based on Debian, not on Ubuntu what I want. Commented Apr 26, 2015 at 19:17

1 Answer 1

1

You can see a more complete example here for NGiNX:

# Install Nginx.
RUN \
  add-apt-repository -y ppa:nginx/stable && \
  apt-get update && \
  apt-get install -y nginx && \
  rm -rf /var/lib/apt/lists/* && \
  echo "\ndaemon off;" >> /etc/nginx/nginx.conf && \
  chown -R www-data:www-data /var/lib/nginx

For php-fpm, you have this example:

RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys E5267A6C; \
    echo 'deb http://ppa.launchpad.net/ondrej/php5/ubuntu trusty main' > /etc/apt/sources.list.d/ondrej-php5-trusty.list; \
    apt-get update ; \
    apt-get -y install php5-fpm php5-mysql php-apc php5-imagick php5-imap php5-mcrypt php5-curl php5-cli php5-gd php5-pgsql php5-sqlite php5-common php-pear curl php5-json php5-redis redis-server memcached php5-memcache ; \
    apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

In both cases, note the usage of:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.