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

Where does Docker install gems on a mac
What is the difference between docker-machine and docker-compose?
Docker Compose port issue. Cannot launch docker project on localhost
Name an image built from running a docker-compose file
Race conditions after changing names in docker-compose.yml
Docker compose - image not found
How to work out the hostname that compose gives containers?
docker-compose restart container if service is dead
Swarm scheduling not working as expected using filters in compose file
issues in buiding Slate with Docker
Invalid type error in Docker Compose
Django cookiecutter with Docker add pip package
Docker Compose + Swarm + Machine Networking issue
docker-compose build image parameters --force-rm --pull
linking 2 containers through docker compose
Files created by manage.py commands not chown'd from root user

Categories

HOME
gcc
leaflet
pyspark
locale
jenkins-pipeline
customization
crm
spss
salesforce-lightning
redhawksdr
sdk
checkpoint
docker-compose
cracking
drush
comma
dompdf
openscad
taxonomy
accordion
include-path
gsuite
boosting
recreate
r-factor
selenium3
n1ql
android-geofence
word-wrap
iterm2
amazon-rds-aurora
spring-cloud-bus
skype-bots
e4
jcifs
hellosign
dmalloc
breadcrumbs
dimensionality-reduction
mate-desktop
geokit
jigsaw
hoare-logic
git-cherry-pick
nimbus
system-integration
jmh
radar-chart
ideavim
dcast
ewam
android-contentresolver
windows-phone-8-emulator
borland-c++
glog
mergecursor
copy-on-write
famous-engine
worklight-appcenter
step
django-tests
infor-eam
facebook-likebox
mysql-error-1146
octokit
oc4j
dd4t
removeall
coinbase-php
servicemanager
ftpwebrequest
quit
configurationsection
pdf-reader
mvcmailer
helicontech
idtabs
session-hijacking
nbehave
lwp
silverlight-2.0
focus-stealing
time-management
djangoappengine
bootstrap-protocol

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