Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find locally built image #1568

Closed
brianfoshee opened this issue Jun 18, 2015 · 4 comments
Closed

Unable to find locally built image #1568

brianfoshee opened this issue Jun 18, 2015 · 4 comments
Assignees
Labels
Milestone

Comments

@brianfoshee
Copy link

I have a locally built image (built with docker build -t project/heroku-base ./project-heroku-base) that version 1.3 of docker-compose is not finding during the build process for another image.

I can build with docker build app ./app, and with version 1.2 of docker-compose I can build with docker-compose build app.

$ docker-compose build app
Building app...
Step 0 : FROM project/heroku-base:latest
Pulling repository project/heroku-base
Service 'app' failed to build: Error: image project/heroku-base:latest not found
$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
project/heroku-base latest              ebe895ea759a        10 minutes ago      1.325 GB
mysql               latest              d63d4723d715        2 days ago          283.5 MB
debian              jessie              bf84c1d84a8f        2 days ago          125.2 MB
heroku/cedar        14                  89fc314a0a6e        4 weeks ago         1.242 GB
busybox             latest              8c2e06607696        8 weeks ago         2.433 MB
$ docker-compose -v
docker-compose version: 1.3.0
CPython version: 2.7.9
OpenSSL version: OpenSSL 1.0.1e 11 Feb 2013
$ docker version
Client version: 1.7.0
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 0baf609
OS/Arch (client): linux/amd64
Server version: 1.7.0
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 0baf609
OS/Arch (server): linux/amd64
@aanand
Copy link

aanand commented Jun 19, 2015

Thanks for reporting. I can reproduce this with Compose 1.3.0 and Docker 1.7.0, but the following combinations do not exhibit the problem:

  • Compose 1.3.0 and Docker 1.6.2
  • Compose 1.2.0 and Docker 1.7.0
$ cat repo/Dockerfile
FROM busybox

$ cat app/Dockerfile
FROM user/repo:latest

$ cat docker-compose.yml
app:
  build: ./app
$ docker build -t user/repo ./repo
Sending build context to Docker daemon 2.048 kB
Sending build context to Docker daemon
Step 0 : FROM busybox
 ---> 8c2e06607696
Successfully built 8c2e06607696

$ docker-compose build app
Building app...
Step 0 : FROM user/repo:latest
Pulling repository user/repo
Service 'app' failed to build: Error: image user/repo:latest not found

When using Docker 1.7.0, here's the (working) request sent by the Docker 1.7.0 client:

POST /v1.19/build?cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=Dockerfile&memory=0&memswap=0&rm=1&t=app

Here's the (working) request sent by Compose 1.2.0:

POST /v1.15/build?pull=True&nocache=False&q=False&t=1568_app&forcerm=False&rm=True

Here's the (non-working) request sent by Compose 1.3.0:

POST /v1.18/build?pull=True&nocache=False&q=False&t=1568_app&forcerm=False&rm=True

Perhaps the problem is isolated to a particular API version or range of versions (1.15 and 1.19 work, 1.18 doesn't).

@aanand
Copy link

aanand commented Jun 19, 2015

Right. After some digging, I've found the problem:

The stable version of docker-py has a bug in build() where pull=True by default (docker/docker-py#622). This means that on every docker-compose build, we're asking the daemon to pull the image, even if it exists locally. This was fixed in docker/docker-py#624.

The reason it works with Docker 1.6.2 is actually because of a bug in the Docker API where the pull parameter is ignored if it's not set to "1": moby/moby#13631. Docker 1.7.0 longer ignores the pull parameter. So this bug has appeared because another bug was fixed.

I've fixed it by explicitly setting pull=False in Compose: #1570

@aanand aanand closed this as completed Jun 19, 2015
@aanand aanand added this to the 1.3.1 milestone Jun 19, 2015
@brianfoshee
Copy link
Author

Great, thanks!

@jamshid
Copy link

jamshid commented Jun 21, 2015

Also hit this bug after upgrading. You can get a docker-compose OSX binary with this fix by running:

sudo easy_install pip
sudo pip install virtualenv
git clone https://github.com/docker/compose.git
cd compose
emacs service.py # add "pull=False" like https://github.com/docker/compose/pull/1570/files
emacs script/build-osx # remove "/local" from python path
script/build-osx
cp -p ./dist/docker-compose-Darwin-x86_64 /usr/local/bin/docker-compose

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants