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

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

Closed
schmunk42 opened this issue Jun 15, 2015 · 4 comments
Closed

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

schmunk42 opened this issue Jun 15, 2015 · 4 comments

Comments

@schmunk42
Copy link

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.

@josephpage
Copy link

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.

@vovimayhem
Copy link

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.

@schmunk42
Copy link
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.

@dnephin
Copy link

dnephin commented Oct 26, 2015

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
Projects
None yet
Development

No branches or pull requests

4 participants