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

Dependencies on startup #676

Closed
vgeyer opened this issue Nov 25, 2014 · 7 comments
Closed

Dependencies on startup #676

vgeyer opened this issue Nov 25, 2014 · 7 comments

Comments

@vgeyer
Copy link

vgeyer commented Nov 25, 2014

Hi there,
I've got a little problem. I did this:

web:
  build: ./env/web/
  volumes:
    - ./env/web/:/var/www/html
cli:
  build: ./env/cli/
  volumes:
    - ./env/cli/:/app/
db:
  image: dockerfile/mariadb
  volumes:
    - ./data/db/mysql/:/var/lib/mysql/

Well, a fig build works nice, a fig up_ produces something like that:

Recreating exampletv_web_1...
Recreating exampletv_db_1...
Recreating exampletv_cli_1...
Attaching to exampletv_web_1, exampletv_cli_1
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.178. Set the 'ServerName' directive globally to suppress this message
web_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.178. Set the 'ServerName' directive globally to suppress this message
web_1 | [Tue Nov 25 15:57:16.325314 2014] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/5.6.3 configured -- resuming normal operations
web_1 | [Tue Nov 25 15:57:16.325421 2014] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
exampletv_cli_1 exited with code 0
Gracefully stopping... (press Ctrl+C again to force)
Stopping exampletv_web_1..

I think because of the cli container which is a run once container and does nothing by default. This is the desired behavior because fig run cli /bin/bash should be run manually.

Is there any way to disable this "dependency" behavior?

@thaJeztah
Copy link
Member

Possibly a silly question, but did you run fig up -d or fig up? Without -d, fig runs 'interactively', so pressing CTRL-C will the containers that were started by fig.

With -d, fig will start the containers in the background ('daemonized') and they will keep running.

@vgeyer
Copy link
Author

vgeyer commented Nov 25, 2014

I tried both, but even with -d all containers exited silently..

@nonsensery
Copy link

Yeah, I think the design of fig up is to start all services, and then stop them as soon as one of them exists exits. I'd guess that your cli service exits immediately because the services are run non-interactively (no stdin). I think the recommended way to do this would be to use fig up db web to start just those services.

That said, it would be nice if there were a way to exclude certain services from fig up.

@vgeyer
Copy link
Author

vgeyer commented Nov 27, 2014

kk, thy!

This would be a nice feature! +1

@dnephin
Copy link

dnephin commented Dec 2, 2014

I tried both, but even with -d all containers exited silently..

-d should run them in the background, did you try fig ps or docker ps to see what was running?

@nonsensery
Copy link

FYI: I've submitted a proposal (Issue #697) to allow certain containers, like your cli container, to be excluded when running fig up.

@dnephin
Copy link

dnephin commented Sep 18, 2015

As of docker-compose 1.4 up will keep running until all containers have stopped

@dnephin dnephin closed this as completed Sep 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants