Here's my Dockerfile:

FROM php:5-fpm

RUN apt-get update
RUN apt-get install -y php5-mysql
RUN apt-get install -y php5-xdebug
RUN apt-get install -y php5-mcrypt
RUN apt-get install -y php5-gd

When I run from Docker for Mac everything works great. But from my Linux machine I get:

E: Package 'php5-mysql' has no installation candidate
The command '/bin/sh -c apt-get install -y php5-mysql' returned a non-zero code: 100

Shouldn't these behave the same?


Thanks to @caylorme for recommending I check the base image on both hosts. They are indeed different image ids.

On the Linux host:

$ sudo docker images php
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
php                 5-fpm               9b179c4d385e        7 days ago          367MB

On the Mac host:

$ docker images php
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
php                 5-fpm               707631468b8b        11 months ago       362MB

But how is that possible? I had assumed (wrongly I guess) that Docker image tags are immutable so you could guarantee reproducibility and rebuild/run on any Docker host. What can I do get the image that's on my Mac host on the Linux host?

  • I guess the latest 5-fpm you got 7 days ago is far different from the one you got 11 month ago, may worth a docker pull on your mac to update the base image and reproduce the problem.
    – Tensibai
    Jan 26, 2018 at 16:10
  • Thanks. I guess I'm afraid to do that because what works on my machine locally I want to replicate on the Linux host. I don't want to lose that image that still works. Make sense?
    – skb
    Jan 26, 2018 at 16:16
  • 1
    I understand your concern, but it doesn't really make sense as it won't work anywhere else not having the same base image as you. You should really update your mac and fix your docker file so it will work. From what I guess in debian jessie the mysql package has probably been renamed. (Side note you should avoid multiples apt-get install and list all packages wanted on the same command: RUN apt-get install -y php5-mysql php5-xdebug ... )
    – Tensibai
    Jan 26, 2018 at 16:33

1 Answer 1


It is possible that the base image is different on each host. Can you confirm the images for php:5-fpm on each host are identical?

If the image from the Mac host is older, try updating it. You may need to update the package name in the dockerfile.

If you want to preserve the same behavior on your newer host, make sure you are pulling the image with the same hash or version-specific tag. It’s quite possible the newer version of the php image is on a newer version of Ubuntu. The package name may have changed between repos.

  • Looks like you're right. Will add details to my question.
    – skb
    Jan 26, 2018 at 14:30
  • Added details and follow up question.
    – skb
    Jan 26, 2018 at 14:38

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.