HiveBrain v1.2.0
Get Started
← Back to all entries
patterndockerMinor

Why can I build this image from Docker for Mac but not on Docker CE for Ubuntu?

Submitted by: @import:stackexchange-devops··
0
Viewed 0 times
thiswhycanimagedockerubuntubutformacfrom

Problem

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 @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?

Solution

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.

Context

StackExchange DevOps Q#3196, answer score: 2

Revisions (0)

No revisions yet.