Skip to content

How to use images, which are build in the same stack? #1548

Closed

Description

@schmunk42

continued from #1175

I have this docker-compose.yml in a folder called testapp.

src:
    build: .
worker:
    image: testapp_src
cli:
    image: testapp_src

When pulling images with docker-compose pull I get the following error (in 1.2 only in verbose mode):

Kraftbuch:testapp tobias$ docker-compose build
Building src...
Step 0 : FROM debian
 ---> f5224fc54ad2
Successfully built f5224fc54ad2
worker uses an image, skipping
cli uses an image, skipping
Kraftbuch:testapp tobias$ docker-compose --verbose pull
Compose version 1.2.0
Docker base_url: https://192.168.59.103:2376
Docker version: KernelVersion=4.0.3-boot2docker, Arch=amd64, ApiVersion=1.18, Version=1.6.2, GitCommit=7c8fca2, Os=linux, GoVersion=go1.4.2
Pulling worker (testapp_src:latest)...
docker pull <- (u'testapp_src:latest', insecure_registry=False)
docker pull -> u'{"status":"Pulling repository testapp_src"}\r\n{"errorDetail":{"message":"Error: image library/testapp_src:latest not found"},"error":"Error: image library/testapp_src:latest not found"}\r\n'
Pulling cli (testapp_src:latest)...
docker pull <- (u'testapp_src:latest', insecure_registry=False)
docker pull -> u'{"status":"Pulling repository testapp_src"}\r\n{"errorDetail":{"message":"Error: image library/testapp_src:latest not found"},"error":"Error: image library/testapp_src:latest not found"}\r\n'
Kraftbuch:testapp tobias$ 

I didn't really notice this behavior until 1.3rc2, because docker-compose will now throw an error instead of failing silently without error.

So my question is, how to use images, which are build in the same stack?

As discussed in the issue above, I don't want to build/tag multiple images or even use different images for the services.

Activity

  1. josephpage commented on Jun 17, 2015

    @josephpage

    Just like this :

    src:
        build: .
    worker:
        build: .
    cli:
        build: .
    

    The build process will use cache for the 2 last services, and will be very quick.

  2. vovimayhem commented on Jun 17, 2015

    @vovimayhem

    That does work, but I suspect you're trying to launch some sort of development environment. If that's true, I find more effective to use a prebuilt interpreter image (i.e. ruby, php, etc) which should run an app from a specific folder in the container, into which you could mount your app code.

    This way you'd be spared from building the entire app container whenever your code changes.

    I have an example rails project using docker-compose that you can check out.

  3. schmunk42 commented on Jun 18, 2015

    @schmunk42
    Author

    @josephpage As said, this leads to other problems, see #1175 for details.

    I find more effective to use a prebuilt interpreter image (i.e. ruby, php, etc) which should run an app from a specific folder in the container, into which you could mount your app code.

    @vovimayhem We're using that approach in development and it's fine to use host-volumes there, but unfortunately that's no solution for production environments.

    I switched to two builds for now, just in case if you're asking yourself about the setup ... the appsrc container may be dropped in development, but we need it in Testing and CI, otherwise we're getting circular dependencies.

  4. dnephin commented on Oct 26, 2015

    @dnephin

    We added a new flag to pull to skip these errors for this kind of scenario in #2032

    It will be in the 1.5.0 release, and is in master builds now (https://dl.bintray.com/docker-compose/master/)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions