<p>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?</p>

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

<p>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.</p>

CC BY-SA 3.0
2018-01-26T14:30:30.383Z
Looks like you're right. Will add details to my question.
skb
CC BY-SA 3.0
2018-01-26T14:38:50.770Z
Added details and follow up question.
skb
CC BY-SA 3.0
2018-01-26T04:48:48.877Z
2018-01-27T17:58:48.523Z
2018-01-27T17:58:48.523Z
caylorme
<p>Here's my Dockerfile:</p>

<pre><code>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
</code></pre>

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

<pre><code>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
</code></pre>

<p>Shouldn't these behave the same?</p>

<p><strong>UPDATE 1</strong></p>

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

<p>On the Linux host:</p>

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

<p>On the Mac host:</p>

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

<p>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?</p>

CC BY-SA 3.0
2018-01-26T16:10:11.970Z
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
CC BY-SA 3.0
2018-01-26T16:16:33.203Z
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
CC BY-SA 3.0
2018-01-26T16:33:36.917Z
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
<docker><dockerfile>
Why can I build this image from Docker for Mac but not on Docker CE for Ubuntu?
skb
# Why can I build this image from Docker for Mac but not on Docker CE for Ubuntu?

(Asked by: username_0 on 2018-01-26)

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?
UPDATE 1
Thanks to @username_2 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?

**Tags:** docker, dockerfile

> **Comments:**
> **username_1**: 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.  
> **username_0**: 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?  
> **username_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 ...` )  

---

## 1 answers

### Answer by username_2 on 2018-01-26. Score: 2 | Accepted answer

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.

> **Comments:**
> **username_0**: Looks like you're right. Will add details to my question.  
> **username_0**: Added details and follow up question.  

---

