Binaries inside Docker container images not being started when not explicitly called

I’m building my own Dockerfile with official images as it’s base which I’m adjusting with Ansible for simple configuration changes. Relevant portion of the dockerfile:

FROM php:7.0-fpm
MAINTAINER hyperfocus

# Ansible cmds

EXPOSE 9000
CMD [“php-fpm”]

Whenever the image is built and I try to start it with docker run php_fpm_prod:v0.1 it gives me the error: /bin/sh: 1: [“php-fpm”]: not found.

  • Docker procedure - treat local copy as staging server?
  • How can I add a file from my computer to a Docker container?
  • VisualGC to a remote JVM running in docker
  • automated docker build run error: Unable to find image
  • In docker-compose how to create an alias / link to localhost?
  • How do I start a group of containers, keep them running, then begin an identical process in each container
  • But whenever I try to start it with docker run php_fpm_prod:v0.1 php-fpm it starts succesfully:

    [03-Nov-2015 10:24:38] NOTICE: fpm is running, pid 1
    [03-Nov-2015 10:24:38] NOTICE: ready to handle connections
    

    How can I make docker run php_fpm_prod:v0.1 behave like docker run php_fpm_prod:v0.1 php-fpm?

    Thanks.

  • Docker mongodb - how are data only containers portable
  • How to build an Image using Docker API?
  • share images between host and child docker
  • unable to install pg-native (libpq-dev) on ubuntu 14.04
  • cannot use curl to load docker image from a tarball using docker api
  • Docker error while PULL - Error downloading dependent layers
  • One Solution collect form web for “Binaries inside Docker container images not being started when not explicitly called”

    The CMD of a php fpm Dockerfile is already CMD ["php-fpm"] (overriding the debian-jessie CMD), so you shouldn’t need to specify it again.

    Those debian or php fpm Dockerfile don’t define an ENTRYPOINT which means thedefault one applies /bin/sh -c.

    First, make sure, as in “Dockerfile CMD command not found” to use the right quotes:

    CMD ["php-fpm"]
    

    (Or don’t specify the CMD at all, since it will be inherited from the base image)

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.