docker-compose


In Docker Compose can I have services exiting


I am trying to use Docker Compose to build a series of services that make up a web server and its components and then make them live. However, some of the "services" I want there are just to create "Volumes" to populate directories such as node_modules, or bower_components. This allows me to have much more control over the versioning of things.
What I can't find out is what happens to these services if they exit (with exit(0)). Does the remainder of the services keep running successfully.
I "could" perhaps have a small task which just waits for the sigint like so:-
(function() {
'use strict';
process.on('SIGINT', function() {
process.exit(0);
});
})();
but this seems like a bit of a fudge.
If your service is up just do certain job and die why instead of letting them to hang till you manually kill them, just not monitor them via docker-compose logs -f ${service} / using stdout/stderr of their specific containers?
Docker-compose streams logs into specific container-bound log file, and you can access to its data both via docker-compose cli, docker API, readable file stream and what else. While majority of theese could be overkill for your case - using docker-compose logs -f is very convinient method to get container-specific activity report.
Still if you really want to keep them alive you can create npm script
(via package.json) that will attach signal event handler as you wrote from specific file. You can add such command to the service command
command: sh -c 'do your stuff; npm run wait-signal-server'
You can use plain js file and just use it via node file.js but using/ running as npm scripts is more convenient way for such things - in my oppinion

Related Links

Docker compose, set local volume mapping with version 3
version control of docker-compose.yml
Limit resources in docker-compose v3
Docker compose: using relative service address in environment
Azure Container Service: Update Docker-Compose?
Docker compose: doesnt allow to use constraints if you have a env variable set
How to use visual studio docker function on Windows Home edition?
Passing arguments to docker compose file when using it for swarm
How to run ad hoc docker compose commands in Ansible?
Using custom hostnames for docker local development containers
Changing the network name?
Let external container know about subnets created by multiple docker-compose projects
How to monitor / discover more docker containers with prometheus
two docker-compose .yml in the same network with COMPOSE_PROJECT_NAME
docker compose 3.1(swarm), secrets, ssl and nginx
What is the version directive for?

Categories

HOME
fortran
postgresql-9.3
phantomjs
c++builder
boxplot
jquery-plugins
where
datetimepicker
aggregation-framework
procmon
digital
select2
jcodemodel
google-search-appliance
aws-sdk-cpp
browsermob
descriptor
xna
ejb-3.1
ppp
gulp-jshint
request-uri
ds-5
ocl
ibm-bpm
contextmenustrip
node-soap
gitosis
pyenv
matrix-multiplication
iterm2
lfe
rbac
delphi-xe
quartz
mtm
paperclip
nshttpurlresponse
weld
hierarchical-clustering
django-tables2
google-cloud-shell
aot
selection-sort
sharing
lattice
gevent
optional-parameters
x12
class-design
require-handlebars
angularfire
system-integration
jmap
markerspiderfier
personality-insights
bootstrap-tabs
openhab
borland-c++
eggplant
cakephp-2.6
stderr
screen-lock
indices
qxorm
nsurlrequest
worklight-appcenter
rda
code-smell
object-oriented-database
nvcc
mahara
svg-android
google-mirror-api
ie-developer-tools
static-class
dynamic-expresso
azure-scheduler
google-checkout
pudb
rbm
nude.js
facebook-winjs-sdk
nsundomanager
httppostedfilebase
hwnd
nbehave
excellibrary
lgpl
mdd

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App